expressionHelpers: {
    clearCustom(): void;
    get(name: string): undefined | ExpressionHelper;
    has(name: string): boolean;
    loadLibrary(raw: unknown): LoadLibraryResult;
    names(): string[];
    register(name: string, fn: ExpressionHelper): void;
    registerSource(name: string, source: HelperSource): void;
} = ...

The global, process-wide helper library that every SafeExpression consults. Seeded with the STANDARD_HELPERS built-ins; a world may layer additional helpers on top (see registerSource), typically loaded from a GM-chosen JSON file at world init.

It is a singleton by design: helpers are language-level, not per-expression, so an expression never carries its own copy.

Type declaration

  • clearCustom:function
  • get:function
  • has:function
  • loadLibrary:function
    • Replace all custom helpers with a world-authored library.

      Resets to the built-ins, then compiles and installs each valid entry. Invalid or unsafe entries are skipped (not thrown) so one bad helper cannot block the rest; the result reports what installed and what did not. Call whenever the world's helper file changes.

      Parameters

      • raw: unknown

        The parsed library: a map of helper name to HelperSource.

      Returns LoadLibraryResult

      Which helpers installed and which were skipped (with reasons).

  • names:function
  • register:function
  • registerSource:function
    • Compile a world-authored helper from its source and install it.

      The body is compiled with textToFunction, which applies static safety screening but is a sandbox, not a hard security boundary — the source is expected to come from a GM-chosen (trusted) world file.

      Parameters

      • name: string

        The helper name (as called from an expression).

      • source: HelperSource

        The helper's parameter names and function body.

      Returns void

      If a parameter name is invalid or the body fails safety screening.