Interp

hscript.Interpceramic.Interp (Class)

Custom HScript interpreter with Ceramic-specific functionality.

Extends the base interpreter to:

  • Support ScriptModule method calls
  • Automatically destroy entities created by scripts
  • Catch and handle runtime errors gracefully

Instance Members

script
new(owner: Script): Void

Creates a new interpreter for the given script.

Name Type Description
owner Script Script that owns this interpreter

Private Members

script
owner: Script

The Script instance that owns this interpreter


script
fcall(o: Dynamic, f: String, args: Array<Dynamic>): Dynamic

Handles function calls on objects. Special handling for ScriptModule to enable inter-script calls.

Name Type Description
o Dynamic Object to call method on
f String Function name
args Array<Dynamic> Function arguments
Returns Description
Dynamic Function result

script
get(o: Dynamic, f: String): Dynamic

Gets a field value from an object. Special handling for ScriptModule to access exported variables.

Name Type Description
o Dynamic Object to get field from
f String Field name
Returns Description
Dynamic Field value

script
cnew(cl: String, args: Array<Dynamic>): Dynamic

Creates a new instance of a class.

Entities created by scripts are automatically destroyed when the script is destroyed, preventing memory leaks.

Name Type Description
cl String Class name
args Array<Dynamic> Constructor arguments
Returns Description
Dynamic New instance

script
exprReturn(e: hscript.Expr): Dynamic

Executes a return expression with error handling.

Catches runtime errors to prevent scripts from crashing the application. Failed scripts are marked as broken and destroyed.

Name Type Description
e hscript.Expr Expression to evaluate
Returns Description
Dynamic Expression result or null if error