Lua development
Runtime and limits
Libraries, state lifetime, execution budgets and output behavior.
Local Lua 5.4
See scripting/scripts.cpp, specifically initialize and execute. Every execution creates a fresh Lua state and closes it on completion. Globals do not persist across separate runs.
Available libraries
| Library or function | Current behavior |
|---|---|
| Base, table, string, math, utf8 | Registered |
| io, os, package, debug, coroutine | Not registered |
| dofile, loadfile, load, collectgarbage | Removed from the global environment |
| Custom implementation writing to the editor output |
A local-only example
This example uses only a table and string formatting. No game backend is required.
local palette = { "Galaxy", "Mars", "Aurora" }
for index, name in ipairs(palette) do
print(string.format("%d: %s", index, name))
end Execution budgets
| Budget | Value | Meaning |
|---|---|---|
| Lua allocation | 8 MiB | The custom allocator caps the Lua state. |
| Deadline | 250 ms | Checked by the Lua hook, not a hard interruption of arbitrary C++ calls. |
| Instructions | 200,000 | The hook checks in batches of 1,000 instructions. |
| Output | 16,000 bytes | Older text is discarded once the buffer exceeds the limit. |
Errors and completion
Load and execution errors are appended to editor output. Budget cancellation reports Script stopped: cancelled or execution budget exceeded. A working local runtime does not demonstrate that the game backend is ready.
K€T4M1N