Constructor
Methods
# call(path, args) → {String|Number|Object|Array|function}
Calls a function within the VM state at the given lua path and returns the result.
Parameters:
Name | Type | Description |
---|---|---|
path |
String | Array | Lua path |
args |
Array | Function arguments |
# eval(code) → {String|Number|Object|Array|function}
Evaluates the given script within the VM state and returns the result.
Parameters:
Name | Type | Description |
---|---|---|
code |
String | Lua code string |
# exec(code) → {VM}
Evaluates the given script within the VM state and returns the modified state.
Parameters:
Name | Type | Description |
---|---|---|
code |
String | Lua code string |
# extend(extension) → {VM}
Extends the VM state with the given module or modules.
Parameters:
Name | Type | Description |
---|---|---|
extension |
Extension | Array | Extension class or array |
# get(path) → {String|Number|Object|Array|function}
Returns the value from the specified path on the VM state.
Parameters:
Name | Type | Description |
---|---|---|
path |
String | Array | Lua path |
# set(path, value, opts) → {VM}
Sets the value at the specified path on the VM state.
Parameters:
Name | Type | Description |
---|---|---|
path |
String | Array | Lua path |
value |
String | Number | Object | Array | Value |
opts |
Object | Options |
# setDeep(path, value) → {VM}
Sets the value at the specified deeply nested path on the VM state.
Parameters:
Name | Type | Description |
---|---|---|
path |
String | Array | Lua path |
value |
String | Number | Object | Array | Value |
# setFunction(path, callback, opts) → {VM}
Sets a JavaScript function at the specified path on the VM state.
Automatically detects if the function is an AsyncFunction
, and if so
handles yielding and resuming from Lua.
Parameters:
Name | Type | Description |
---|---|---|
path |
String | Array | Lua path |
callback |
function | JavaScript function |
opts |
Object | Options |