Did you know that a lot of the in-game Lua code can be tested directly in the Giants editor or even directly via the stand-alone Lua interpreter?
However, there are some limitations. E.g. some features are restricted by Giants due to security considerations, and some game specific core Lua functions are simply not available in the native Lua interpreter.
Below is a summary of functions and classes that mihgt be available only in one, two or all three enviroments, sometimes with limited functionality.
Explanation:
- Yes: Supported (unless specified with a number)
- No: Not natively supported (unless specified with a number)
- *: Replacement/equivivalent function in specificed environment
- 1: Not natively supported, but works with FS Shim
- 2: Not natively supported, but works with FS Stub
- 3: Partly supported, with limited functionality
- 4: Not natively supported, but can be included via FS Shim
What | In-game | Giants Editor | Lua/LuaJIT |
---|---|---|---|
Class() | Yes | Yes2 | Yes2 |
io | Partly3 | Partly3 | Yes |
printf() | Yes | Yes2 | Yes2 |
g_currentModName | Yes | Yes2 | Yes2 |
g_* tables | Yes | No | No |
getTimeSec() | Yes | Yes | Yes1 |
getDate() | Yes | Yes | Yes1 |
getTime() | Yes | Yes | Yes1 |
netGetTime() | Yes | Yes | Yes1 |
string.dump() | No | No | Yes |
loadfile() | No | No | Yes |
load() | No | No | Yes |
fileExists() | Yes | Yes | Yes1 |
source() | Yes | Yes | Yes1 |
delete() | Yes | Yes | Yes1 |
DebugUtil.printTableRecursively() | Yes | ? | Yes1 |
usleep() | Yes | Yes | Yes1 |
os.clock() | getTimeSec() | getTimeSec() | Yes |
os.date() | getDate() | getDate() | Yes |
createFile() | Yes | Yes | io.open() |
require() | source()3 | source()3 | Yes |