allow calling namespaced torque functions

This commit is contained in:
Redo
2025-10-05 22:31:21 -05:00
parent 7da249cca1
commit edf31c178c
3 changed files with 34 additions and 13 deletions

View File

@@ -12,12 +12,12 @@ Lua scripting for Blockland
## Quick Reference
### From TorqueScript
`'print('hello world')` - Execute Lua code in the console by prepending a `'` (single quote)
`luaeval("code");` - Eval Lua code
`luacall("funcName", %args);` - Call a Lua global function
`'print('hello world')` - Execute Lua in the console by prepending a `'` (single quote)
`luaeval("code");` - Execute Lua code
`luacall("funcName", %args...);` - Call a Lua global function
`luaexec("fileName");` - Execute a Lua file. Path rules are the same as executing .cs files.
`luaget("varName");` - Read a Lua global variable
`luaset("varName");` - Write a Lua global variable
`luaset("varName", %value);` - Write a Lua global variable
### From Lua
`bl.eval('code')` - Eval TorqueScript code
@@ -181,7 +181,7 @@ TorqueScript stores no type information; all values in TorqueScript are strings.
All Lua code is sandboxed, and file access is confined to the default directories in the same way TorqueScript is.
BlockLua also has access to any C libraries installed in the `modules/lualib` folder, so be careful throwing things in there.
### Unsafe Mode
BlockLua-Unsafe.dll can be built and used in place of BlockLua.dll (see compile.bat), to remove the sandboxing of Lua code. This allows Lua code to access any file and use any library, including ffi.
BlockLua can be built in Unsafe Mode by specifying the `-DBLLUA_UNSAFE` compiler flag. This removes the sandboxing of Lua code, allowing it to access any file and use any library, including ffi.
Please do not publish add-ons that require unsafe mode.
### List of Object Types