RuntimeState

loreline.RuntimeState (Class) → RuntimeCharacter

A state during the runtime execution of a loreline script. States hold field values that can be accessed and modified during script execution.

Instance Members

scope: Int

If set to a value > 0, this state is temporary and linked to a scope. Every time we enter a new block node, we enter a new scope identified by a unique integer value. When exiting that scope, the related temporary states are destroyed.


fields: Any

Fields of this state. Contains the actual data being stored.


originalFields: Any

Original field values, as they are initially declared in the script, as long as they are not dependent on other state values. Used for comparison when serializing to avoid storing unchanged values.


clear(interpreter: Interpreter, node: Node): Void

Clears all fields in this state.

Name Type
interpreter Interpreter
node Node

new(interpreter: Interpreter, node: Node, fields: Any, originalFields: Any): Void

Creates a new runtime state with optional initial field values.

Name Type Description
interpreter Interpreter
node Node
fields Any Initial field values, or null to create empty fields
originalFields Any Original field values for comparison, or null to create empty original fields

Private Members

createOriginalFields(): Void

Creates empty original fields.