Skip to content

Scope

Package: com.hypixel.hytale.server.npc.util.expression

public interface Scope

Contract for providing named variables and functions to the expression compiler and executor. A scope supplies typed supplier accessors for all six value types (string, number, boolean, and their array variants), a function lookup, a constness check, and a type query. Default methods delegate supplier calls for convenience (e.g. getString calls getStringSupplier(...).get()).

Return TypeSignature
Supplier<String>getStringSupplier(String name)
DoubleSuppliergetNumberSupplier(String name)
BooleanSuppliergetBooleanSupplier(String name)
Supplier<String[]>getStringArraySupplier(String name)
Supplier<double[]>getNumberArraySupplier(String name)
Supplier<boolean[]>getBooleanArraySupplier(String name)
FunctiongetFunction(String name)
booleanisConstant(String name)
@Nullable ValueTypegetType(String name)
Return TypeSignature
StringgetString(String name)
doublegetNumber(String name)
booleangetBoolean(String name)
String[]getStringArray(String name)
double[]getNumberArray(String name)
boolean[]getBooleanArray(String name)
ModifierReturn TypeSignature
@Nonnull staticStringencodeFunctionName(@Nonnull String name, @Nonnull ValueType[] values)
staticcharencodeType(@Nonnull ValueType type)

encodeFunctionName produces a mangled key like max@nn for overload resolution. Each ValueType maps to a single character (n, s, b, N, S, B).

@FunctionalInterface
public interface Function {
void call(ExecutionContext context, int numArgs);
}

A callable expression function. Receives the ExecutionContext (with arguments on the stack) and the argument count.

  • StdScope — symbol-table implementation of this interface
  • StdLib — singleton standard library scope
  • ExecutionContext — the VM that reads from scopes
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.