Evaluating Lua at runtime: a string of code, or a file on disk. Both run in the same state as every other script.
What went wrong while running Lua.
Properties:
trx.lua.eval_expr(code)
Evaluates a string of Lua code, as the /lua console command does.
Parameters:
Returns: trx.lua.Error or nil. nil when the code ran to completion, and what went wrong otherwise. A failure comes back as a value rather than raising, so the caller decides what it means.
Example:
trx.lua.eval_expr("trx.console.log('hello')")
trx.lua.eval_file(path)
Runs a Lua file, the way a level script is run. A file that cannot be read reports as a "runtime" failure.
Parameters:
Returns: trx.lua.Error or nil.
Example:
trx.lua.eval_file("data/ship/scripts/extra.lua")