Interpreter
loreline.Interpreter (Class)
Main interpreter class for Loreline scripts.
This class is responsible for executing a parsed Loreline script,
managing the runtime state, and interacting with the host application
through handler functions.
Instance Members
Optional translations map (localization key -> translated string literal).
When set, evaluateString() substitutes tagged text with translated versions.
stringLiteralProcessors: Array<Function>
Pluggable processors that transform string literals before evaluation.
Each processor receives an NStringLiteral and returns a (possibly transformed) NStringLiteral.
Starts script execution from the beginning or a specific beat.
| Name |
Type |
Default |
Description |
beatName |
String |
(optional) |
Optional name of the beat to start from. If null, execution starts from the first beat or a beat named "_" if it exists. |
Restores the interpreter state from a SaveData object.
This allows resuming execution from a previously saved state.
| Name |
Type |
Description |
saveData |
SaveData |
The SaveData object containing the serialized state |
Resumes execution after restoring state.
This should be called after restore() to continue execution.
Gets a character by name.
| Name |
Type |
Description |
name |
String |
The name of the character to get |
| Returns |
Description |
| Any |
The character's fields or null if the character doesn't exist |
Gets a specific field of a character.
| Name |
Type |
Description |
character |
String |
The name of the character |
name |
String |
The name of the field to get |
| Returns |
Description |
| Any |
The field value or null if the character or field doesn't exist |
Sets a specific field on a character.
| Name |
Type |
Description |
character |
String |
The name of the character |
name |
String |
The name of the field to set |
value |
Any |
The value of the field to set |
Sets a state field by name, resolving from the current scope outward.
Walks the execution stack from innermost scope to outermost to find the field,
then falls back to the top-level state if not found anywhere.
| Name |
Type |
Description |
name |
String |
The name of the field to set |
value |
Any |
The value to set |
Gets a field from the top-level state directly.
| Name |
Type |
Description |
name |
String |
The name of the field to get |
| Returns |
Description |
| Any |
The field value or null if the field doesn't exist |
Sets a field on the top-level state directly.
| Name |
Type |
Description |
name |
String |
The name of the field to set |
value |
Any |
The value to set |
Returns the current node being executed.
During a dialogue callback, this returns the dialogue statement node.
During a choice callback, this returns the choice statement node.
| Returns |
Description |
| AstNode |
The current AST node or null if no node is being executed |
Returns the file path of the file containing the current node.
Uses the Lens to walk up through import statements and resolve
the path relative to the given root file path.
Resolves a beat by name against the RUNTIME scope walk (registered
nested beats first, then top-level beats). Only used as fallback for
node-less contexts (function code, engine helpers); node-anchored
resolution goes through resolveBeatRefFromNode (lexical).
| Name |
Type |
Default |
name |
String |
|
scopeLevel |
Int |
-1 |
Resolves a beat by name like resolveBeatByName, but also builds the
scope chain to capture for a beat reference: the resolution path from
the root up to and including the declaring scope (empty for top-level
beats). Used to create RuntimeBeatRef values.
Resolves a beat by name from the given node's LEXICAL position, using
the same resolution as the editor (Lens): innermost enclosing beat
outward, order-independent, nested beats shadowing outer and top-level
ones. When the resolved beat's declaring scope is live on the stack,
the returned reference captures that scope chain (like beat references
do), so the beat keeps its lexical context when invoked.
Falls back to the runtime scope walk only when no node is available
(function code and engine helpers).
| Name |
Type |
Description |
name |
String |
The beat name to resolve |
node |
Node |
The node used as lexical anchor (null in node-less contexts) |
Creates a new Loreline script interpreter.
| Name |
Type |
Default |
Description |
script |
Script |
|
The parsed script to execute |
handleDialogue |
DialogueHandler |
|
Function to call when displaying dialogue text |
handleChoice |
ChoiceHandler |
|
Function to call when presenting choices |
handleFinish |
FinishHandler |
|
Function to call when execution finishes |
options |
InterpreterOptions |
(optional) |
Additional options |
Private Members
The script being executed.
User-defined dialogue handler,
which takes care of displaying the dialogues.
User-defined choice handler,
which takes care of displaying the choices and
providing a response to the interpreter.
User-defined finish handler,
which is called when the current execution has finished.
The top level state, which is shared across the whole script execution.
Top level characters can be referenced and their state
can also be modified from anywhere in the script.
All the top level beats available, by beat name (their identifier in the script).
States associated to a specific node id. These are persistent, like the top level state,
but are only available from where they have been declared and the sub-scopes.
If some state fields already existed in a parent scope, the parent ones will be shadowed by the child ones.
Top level functions available by default in this script.
Built-in functions instance, giving access to RNG for alternative blocks.
The current execution stack, which consists of scopes added on top of one another.
Each scope can have its own local beats and temporary states.
The lens instance allowing to get more information about the AST.
Tells whether access is strict or not. If set to true,
trying to read or write an undefined variable will throw an error.
Current scope associated with current execution state.
Current insertion associated with current scope or a parent scope, with current execution state.
The next scope id to assign when pushing a new scope.
Every time we reset the stack, this counter is also reset.
The next insertion id to assign when creating a new insertion.
Every time we reset the stack, this counter is also reset.
syncCallbacks: Array<Function>
List of pending callbacks that should be run synchronously.
Internal flag to know if we are currently flushing sync callbacks
(to prevent unexpected recursive flushes).
Keep track of which callback is the one that would trigger finish.
When loading saved data and failing to restore a full stack of scope,
this contains the beat to resume as fallback.
That beat will always be a top level beat.
When a choice with insertions is waiting for user input, this holds
the collected options. Persisted in save data so that on restore,
insertion bodies are not re-evaluated (which would cause side effects
to run twice).
Nearest insertion carried by a scope at or below the given stack level.
removeCurrentInsertion(): Void
A custom instanciator to create fields objects.
inferImplicitCharactersFromRootBeat(): Void
Registers an implicit (empty) character for every dialogue speaker mentioned inside the
default unnamed beat ("_"), unless a top-level character or state field already uses that
name. Runs after explicit declarations are initialized so it never overrides them.
resumeFromLevel(scopeLevel: Int, next: Function): Void
| Name |
Type |
scopeLevel |
Int |
next |
Function |
eachResolutionScope(startIndex: Int, visit: Function): Void
Walks scopes for name resolution, innermost to outermost, starting at
startIndex (-1 for the innermost scope). When a scope carries a
captured chain (the closure boundary of a beat invoked through a beat
reference), the walk diverts into that chain (innermost to outermost,
recursively) and then STOPS, skipping the scopes below the boundary:
resolution inside a ref-invoked beat is lexical, not dynamic.
visit returns true to stop the walk.
| Name |
Type |
startIndex |
Int |
visit |
Function |
Serializes a scope to save data.
serializeTextTag(tag: TextTag): SaveDataTextTag
Serializes a state to save data.
| Name |
Type |
Description |
state |
RuntimeState |
The state to serialize |
Serializes all top-level characters to save data.
| Returns |
Description |
| Dynamic |
Object mapping character names to their serialized states |
Serializes all node states to save data.
| Returns |
Description |
| Dynamic |
Object mapping node IDs to their serialized states |
Serializes a beat reference for save data.
| Name |
Type |
Description |
beat |
NBeatDecl |
The beat to reference |
| Returns |
Description |
| SaveDataBeat |
The serialized beat reference |
Serializes a node reference for save data.
| Name |
Type |
Description |
node |
AstNode |
The node to reference |
| Returns |
Description |
| SaveDataNode |
The serialized node reference |
Serializes a character for save data.
Serializes fields for save data.
Only fields that have changed from their original values are included.
| Name |
Type |
Default |
Description |
fields |
Any |
|
The fields to serialize |
originalFields |
Any |
(optional) |
The original field values for comparison |
serializeValue(value: Any): Any
Serializes a value for save data.
Handles recursive serialization of objects and arrays.
| Name |
Type |
Description |
value |
Any |
The value to serialize |
| Returns |
Description |
| Any |
The serialized value |
Core function that resumes execution from a given scope.
Works by recreating the execution flow as if we had been running from the beginning.
| Name |
Type |
Description |
node |
AstNode |
The node to resume from |
scopeLevel |
Int |
The scope level to resume at |
next |
Function |
Callback to call when the node execution completes |
resumeNodeBody(node: AstNode, scopeLevel: Int, body: Array<AstNode>, next: Function): Void
Resumes execution of a node body.
| Name |
Type |
Description |
node |
AstNode |
The node containing the body |
scopeLevel |
Int |
The scope level to resume at |
body |
Array<AstNode> |
The body to execute |
next |
Function |
Callback to call when the body execution completes |
Resumes execution of a beat.
| Name |
Type |
Description |
beat |
NBeatDecl |
The beat to resume |
scopeLevel |
Int |
The scope level to resume at |
next |
Function |
Callback to call when the beat execution completes |
Resumes execution of a choice option.
| Name |
Type |
Description |
option |
NChoiceOption |
The choice option to resume |
scopeLevel |
Int |
The scope level to resume at |
next |
Function |
Callback to call when the option execution completes |
Resumes execution of a choice
Resumes execution of an if statement.
| Name |
Type |
Description |
ifStmt |
NIfStatement |
The if statement to resume |
scopeLevel |
Int |
The scope level to resume at |
next |
Function |
Callback to call when the if statement execution completes |
Resumes execution of an alternative block.
| Name |
Type |
Description |
alt |
NAlternative |
The alternative node to resume |
scopeLevel |
Int |
The scope level to resume at |
next |
Function |
Callback to call when execution completes |
resumeCall(call: NCall, scopeLevel: Int, next: Function): Void
Resumes execution of a beat call.
| Name |
Type |
Description |
call |
NCall |
The call node to resume |
scopeLevel |
Int |
The scope level to resume at |
next |
Function |
Callback to call when the call execution completes |
Resumes execution through a dynamic beat call statement (beat(expr)).
The restored child scope already knows which beat it was running
(restored by node id), so no expression re-evaluation is needed.
| Name |
Type |
Description |
call |
NBeatCall |
The beat call node to resume |
scopeLevel |
Int |
The scope level to resume at |
next |
Function |
Callback to call when the call execution completes |
Restores the execution stack from saved data.
| Name |
Type |
Default |
Description |
savedStack |
Array<SaveDataScope> |
|
The saved stack data |
savedInsertions |
Dynamic |
(optional) |
The saved insertions map (keyed by insertion ID) |
restoredInsertions |
Map |
(optional) |
|
| Returns |
Description |
| Bool |
True if the stack was restored successfully, false otherwise |
Restores a single scope from saved data, including its insertion reference.
Used by both restoreStack() (for the main stack) and restoreInsertion() (for insertion stacks).
| Name |
Type |
Description |
savedScope |
SaveDataScope |
The saved scope data |
savedInsertions |
Dynamic |
The saved insertions map |
restoredInsertions |
Map |
Cache of already-restored insertions (for circular reference handling) |
| Returns |
Description |
| RuntimeScope |
The restored scope, or null if restoration failed |
Restores a RuntimeInsertion from serialized data.
Uses a cache to handle circular references (insertion.stack contains scopes that reference the same insertion).
| Name |
Type |
Description |
insertionId |
Int |
The insertion ID to restore |
savedInsertions |
Dynamic |
The saved insertions map |
restoredInsertions |
Map |
Cache of already-restored insertions |
| Returns |
Description |
| RuntimeInsertion |
The restored insertion, or null if not found |
Restores a ChoiceOption from serialized data.
| Name |
Type |
Description |
saved |
SaveDataChoiceOption |
The saved choice option data |
savedInsertions |
Dynamic |
The saved insertions map |
restoredInsertions |
Map |
Cache of already-restored insertions |
| Returns |
Description |
| ChoiceOption |
The restored choice option, or null if node resolution failed |
Finds the top-level beat to resume from if stack restoration fails.
| Returns |
Description |
| NBeatDecl |
The beat to resume from, or null if none can be found |
Restores a node from a saved reference.
| Name |
Type |
Description |
savedNode |
SaveDataNode |
The saved node reference |
savedBeatId |
NodeId |
The ID of the beat in the saved data |
beat |
NBeatDecl |
The restored beat |
| Returns |
Description |
| AstNode |
The restored node, or null if it couldn't be found |
Restores a beat from a saved reference.
| Name |
Type |
Description |
beatRef |
SaveDataBeat |
The saved beat reference |
| Returns |
Description |
| NBeatDecl |
The restored beat, or null if it couldn't be found |
Restores a state from saved data.
| Name |
Type |
Description |
state |
RuntimeState |
The state to restore into, or null to create a new one |
data |
SaveDataState |
The saved state data |
Restores characters from saved data.
| Name |
Type |
Description |
data |
Dynamic |
The saved character data |
Restores node states from saved data.
| Name |
Type |
Description |
data |
Dynamic |
The saved node state data |
Restores a character from saved data.
Restores fields from saved data.
| Name |
Type |
Description |
target |
Any |
The target object to restore into, or null to create a new one |
savedFields |
SaveDataFields |
The saved field data |
| Returns |
Description |
| Any |
The object with restored fields |
Restores a value from its saved form.
Handles recursive restoration of objects and arrays.
| Name |
Type |
Description |
value |
Any |
The saved value |
| Returns |
Description |
| Any |
The restored value |
Initializes top-level functions available to the script.
This includes built-in functions and any user-provided functions.
| Name |
Type |
Description |
functions |
FunctionsMap |
Optional map of additional functions to make available |
Registers a single host-provided function under key.
Host functions registered via the public API are documented to receive
(interpreter, args). The core calls functions with the script arguments
spread positionally (like built-ins), so on bindings without a native
adapter we wrap each one to re-collect those into an array and prepend the
interpreter. Bindings with their own adapter (JVM/C#/C++) don't set the
loreline_auto_wrap_functions define and store the function as-is.
initializeStringLiteralProcessors(processors: Array<Function>): Void
| Name |
Type |
processors |
Array |
Wraps a callback function to control whether it executes synchronously or asynchronously.
This is crucial for managing the execution flow of the script.
| Name |
Type |
Description |
cb |
Function |
The callback to wrap |
| Returns |
Description |
| EvalNext |
An EvalNext object controlling the callback's execution |
Flushes all pending synchronous callbacks.
This ensures that all pending operations are completed before continuing.
Pops the top scope from the execution stack.
| Returns |
Description |
| Bool |
True if a scope was popped, false if the stack was already empty |
Pushes a new scope onto the execution stack.
Initializes a top-level state declaration.
Evaluates all fields and stores their values.
| Name |
Type |
Description |
state |
NStateDecl |
The state declaration to initialize |
Initializes a top-level beat declaration.
Registers the beat in the top-level beats map.
| Name |
Type |
Description |
beat |
NBeatDecl |
The beat declaration to initialize |
Initializes a top-level character declaration.
Creates a new character state and evaluates all fields.
| Name |
Type |
Description |
character |
NCharacterDecl |
The character declaration to initialize |
Initializes a state declaration within a scope.
Evaluates all fields and stores their values.
| Name |
Type |
Description |
state |
NStateDecl |
The state declaration to initialize |
scope |
RuntimeScope |
The scope in which to initialize the state |
Evaluates transition/insertion/call arguments in the caller scope and
checks arity against the target beat's declared parameters.
Returns the evaluated values, or null when there are no arguments.
| Name |
Type |
Description |
beat |
NBeatDecl |
The target beat |
args |
Null<Array<NExpr>> |
The argument expressions, if any |
pos |
Position |
Position used to report arity errors |
Seeds beat parameters as beat-scoped temporary state on the given scope.
Missing arguments get their default value (evaluated now, in the new
scope, so defaults can read outer state), or null.
| Name |
Type |
Description |
scope |
RuntimeScope |
The freshly pushed scope of the beat being run |
beat |
NBeatDecl |
The beat being run |
values |
Null<Array<Any>> |
Evaluated argument values, or null |
Finishes script execution and calls the finish handler.
Transitions to a new beat, clearing the current execution stack.
Evaluates a node, dispatching to the appropriate handler based on node type.
| Name |
Type |
Description |
node |
AstNode |
The node to evaluate |
next |
Function |
Callback to call when evaluation completes |
Evaluates a beat declaration.
Adds the beat to the current scope so it can be referenced by other nodes.
| Name |
Type |
Description |
beat |
NBeatDecl |
The beat declaration to evaluate |
next |
Function |
Callback to call when evaluation completes |
evalNodeBody(beat: NBeatDecl, node: AstNode, body: Array<AstNode>, ?insertion: RuntimeInsertion, ?argValues: Array<Any>, ?capturedChain: Array<RuntimeScope>, next: Function): Void
Evaluates a node body by creating a new scope and executing each node in sequence.
| Name |
Type |
Default |
Description |
beat |
NBeatDecl |
|
The parent beat |
node |
AstNode |
|
The node containing the body |
body |
Array<AstNode> |
|
The body to execute |
insertion |
RuntimeInsertion |
(optional) |
If any, the insertion related to this evaluation |
argValues |
Array<Any> |
(optional) |
|
capturedChain |
Array<RuntimeScope> |
(optional) |
|
next |
Function |
|
Callback to call when execution completes |
Evaluates a beat by executing its body.
| Name |
Type |
Default |
Description |
beat |
NBeatDecl |
|
The beat to evaluate |
next |
Function |
|
Callback to call when evaluation completes |
argValues |
Array<Any> |
(optional) |
|
capturedChain |
Array<RuntimeScope> |
(optional) |
|
Evaluates a state declaration.
Initializes the state fields with their evaluated values.
| Name |
Type |
Description |
state |
NStateDecl |
The state declaration to evaluate |
next |
Function |
Callback to call when evaluation completes |
evalText(text: NTextStatement, next: Function): Void
Evaluates a text statement by evaluating the content and calling the dialogue handler.
| Name |
Type |
Description |
text |
NTextStatement |
The text statement to evaluate |
next |
Function |
Callback to call when evaluation completes |
Evaluates a dialogue statement by evaluating the content and calling the dialogue handler.
| Name |
Type |
Description |
dialogue |
NDialogueStatement |
The dialogue statement to evaluate |
next |
Function |
Callback to call when evaluation completes |
Evaluates a choice statement by evaluating the options and calling the choice handler.
| Name |
Type |
Description |
choice |
NChoiceStatement |
The choice statement to evaluate |
next |
Function |
Callback to call when evaluation completes |
Phase 2 of choice evaluation: present collected options to the user
and handle their selection.
| Name |
Type |
Description |
choice |
NChoiceStatement |
The AST choice statement node |
options |
Array<ChoiceOption> |
The collected choice options |
next |
Function |
Callback to call when evaluation completes |
Evaluates a dynamic beat call statement: beat(expr, args...).
Runs the resolved beat as a stack-preserving call, carrying the
captured scope chain when the target is a beat reference.
| Name |
Type |
Description |
call |
NBeatCall |
The beat call node to evaluate |
next |
Function |
Callback to call when evaluation completes |
Evaluates a choice option by executing its body.
| Name |
Type |
Description |
option |
NChoiceOption |
The choice option to evaluate |
next |
Function |
Callback to call when evaluation completes |
Evaluates an if statement by evaluating the condition and executing the appropriate branch.
| Name |
Type |
Description |
ifStmt |
NIfStatement |
The if statement to evaluate |
next |
Function |
Callback to call when evaluation completes |
Evaluates an alternative block (sequence, cycle, once, pick, shuffle).
| Name |
Type |
Description |
alt |
NAlternative |
The alternative node to evaluate |
next |
Function |
Callback to call when evaluation completes |
Executes alternative items in shuffled order, one at a time.
Gets the visit count for a beat from nodeStates.
Increments the visit count for a beat in nodeStates.
Gets the visit count for an alternative block from nodeStates.
Sets the visit count for an alternative block in nodeStates.
Returns whether a once-only choice option has already been chosen.
Marks a once-only choice option as chosen in nodeStates.
Evaluates an assignment by resolving the target, evaluating the value, and applying the assignment.
| Name |
Type |
Description |
assign |
NAssign |
The assignment to evaluate |
next |
Function |
Callback to call when evaluation completes |
isOriginalScriptExpression(expr: NExpr): Bool
Determines whether an expression is an "original script expression" - meaning it only
depends on values directly present in the script and not on runtime state.
Original script expressions can be evaluated at parse time and safely stored as
default values, as they don't depend on dynamic context like variables or
function calls that might change during runtime.
| Name |
Type |
Description |
expr |
NExpr |
The expression to check |
| Returns |
Description |
| Bool |
True if the expression only depends on literal values in the script |
Determines if a node is a beat call.
A beat call is a special function call that executes a beat instead of a normal function.
| Name |
Type |
Default |
Description |
node |
AstNode |
|
The node to check |
scopeLevel |
Int |
-1 |
Optional scope level to search in (defaults to current scope) |
| Returns |
Description |
| Bool |
True if the node is a beat call |
Returns true if the call is the dynamic call(target, args...) special
form: a bare call identifier that isn't shadowed by any script binding.
Builds the scope chain to capture for a lexically resolved beat: the
live scopes from root up to and including the beat's declaring scope,
honoring closure boundaries. Returns an empty array when the beat is
top-level or its declaring scope is not live (chainless).
Resolves a runtime value to a beat reference, for dynamic targets like
beat(expr), -> beat(expr) and + beat(expr).
Accepts a beat reference (keeps its captured chain), a beat value
(wrapped without capture), or a string resolved lexically from the
node's position (capturing the declaring chain when it is live,
exactly like static name resolution).
| Name |
Type |
Description |
value |
Any |
The evaluated target value |
node |
AstNode |
Node used as lexical anchor and to report errors |
Builds the error for an unresolved beat name. When the name exists
somewhere else in the script (another scope), the error teaches the
beat-reference workflow instead of just failing.
Resolves a call node to a beat reference if the call's target is a
bare identifier naming a beat (lexical resolution from the call's
position). This allows handling beat calls differently from regular
function calls.
| Name |
Type |
Description |
call |
NCall |
The call node to resolve |
Evaluates a call node.
If the call references a beat, it executes the beat.
Otherwise, it evaluates it as a regular function call.
| Name |
Type |
Description |
call |
NCall |
The call node to evaluate |
next |
Function |
Callback to call when evaluation completes |
Evaluates a transition node.
Transitions cause execution to jump to a different beat,
clearing the current execution stack.
| Name |
Type |
Description |
transition |
NTransition |
The transition node to evaluate |
If translations are available, checks for a hash comment on the node and returns
the translated string literal if found. Otherwise returns the original string.
Walks the import ancestor chain from the node's own file up to root,
trying each scoped key in turn. A translation defined in an ancestor's
.<lang>.lor file applies to descendants that don't translate the same
key themselves. Siblings (non-ancestor files) never share translations.
Evaluates a string literal into text with tags.
This handles interpolation and tag processing.
| Name |
Type |
Description |
str |
NStringLiteral |
The string literal to evaluate |
| Returns |
Description |
| AnonStruct |
Object containing the evaluated text and any tags |
Processes plural pipe syntax in string literal parts.
Transforms word1|word2 and (text1|text2) patterns in Raw parts preceded by Expr parts
into synthetic NCall nodes that invoke the plural() function.
rawTextHasUnescapedPipe(text: String): Bool
Evaluates a condition expression for an if statement or choice option.
Converts the result to a boolean according to Loreline's rules.
| Name |
Type |
Description |
expr |
NExpr |
The condition expression to evaluate |
| Returns |
Description |
| Bool |
True if the condition evaluates to a truthy value |
Invokes an already-resolved function value with evaluated arguments.
Handles async results and wraps errors, exactly like standalone
function calls always did.
| Name |
Type |
Description |
fn |
Any |
The function value to invoke |
args |
Array<Any> |
Evaluated argument values |
pos |
Position |
Position used to report errors |
next |
Function |
Optional callback for asynchronous execution |
| Returns |
Description |
| Any |
The result of the function call |
Returns true if the given bare identifier resolves to any existing
binding: scope temporary state, node state, top level state field,
character, function or beat. Unlike resolveAccess(), this never
auto-creates anything and never throws.
evaluateDynamicCall(call: NCall, next: Function): Any
Evaluates the call(target, args...) special form: the first argument
resolves to a FUNCTION (a function value, or a string naming one),
called with the remaining arguments. Beats are rejected with a hint
to use beat(...) instead.
| Name |
Type |
Description |
call |
NCall |
The call node (target is the bare call identifier) |
next |
Function |
Optional callback for asynchronous execution |
| Returns |
Description |
| Any |
The function result |
evaluateFunctionCall(call: NCall, next: Function): Any
Evaluates a function call in an expression context.
If next is provided, the function may execute asynchronously.
If next is null, the function must execute synchronously.
| Name |
Type |
Description |
call |
NCall |
The function call node to evaluate |
next |
Function |
Optional callback for asynchronous execution |
| Returns |
Description |
| Any |
The result of the function call |
Evaluates an array literal to a runtime array.
Each element is evaluated recursively.
| Name |
Type |
Description |
expr |
Array<Dynamic> |
The array literal expression to evaluate |
| Returns |
Description |
| Any |
The resulting array |
Evaluates an object literal to a runtime object.
Each field value is evaluated recursively.
| Name |
Type |
Description |
expr |
Array<NObjectField> |
The object literal expression to evaluate |
| Returns |
Description |
| Any |
The resulting object |
Evaluates an expression to its runtime value.
This is the core expression evaluation function that handles all expression types.
| Name |
Type |
Description |
expr |
NExpr |
The expression to evaluate |
| Returns |
Description |
| Any |
The runtime value of the expression |
readAccess(access: Anonymous): Any
Reads the value from a runtime access.
This handles field access, array access, character access, and function access.
| Name |
Type |
Description |
access |
Anonymous |
The runtime access to read |
| Returns |
Description |
| Any |
The value at the access location |
writeAccess(access: Anonymous, value: Any): Void
Writes a value to a runtime access location.
This handles field access and array access.
Character and function access cannot be written to.
| Name |
Type |
Description |
access |
Anonymous |
The runtime access to write to |
value |
Any |
The value to write |
resolveAssignmentTarget(target: NExpr): Anonymous
Resolves an assignment target to a runtime access.
This is used to determine where to write a value in an assignment.
| Name |
Type |
Description |
target |
NExpr |
The target expression to resolve |
| Returns |
Description |
| Anonymous |
The runtime access to write to |
Resolves an access expression to a runtime access.
This handles finding variables, character fields, and functions in the appropriate scopes.
| Name |
Type |
Default |
Description |
access |
NAccess |
|
The access expression to resolve |
target |
NExpr |
(optional) |
Optional target object for field access |
name |
String |
|
The name to access |
| Returns |
Description |
| Anonymous |
The resolved runtime access |
getTypeName(t: Anonymous): String
Helper for getting human-readable type names in errors
| Name |
Type |
Description |
t |
Anonymous |
The type to get a name for |
| Returns |
Description |
| String |
A human-readable name for the type |
Performs a binary operation on two values.
Handles arithmetic, comparison, and logical operations.
| Name |
Type |
Description |
op |
Anonymous |
The operator to apply |
left |
Dynamic |
The left operand |
right |
Dynamic |
The right operand |
pos |
Position |
The source position for error reporting |
| Returns |
Description |
| Any |
The result of the operation |
Converts a value to its string representation.
Used for string interpolation and output.
| Name |
Type |
Description |
value |
Any |
The value to convert to a string |
| Returns |
Description |
| String |
The string representation of the value |
| Name |
Parameters |
:hxGen |
- |
:allow |
loreline.lorscript.Interp |