Lifecycle
All scripts execute in one LuaJIT state. Loading a script runs its main.lua. Reload snapshots the active instance's in-memory storage, initializes a replacement first, and sends shutdown to the previous instance only after the replacement succeeds.
Unload sends the script's shutdown callback, flushes dirty storage to Traceless\script_cache.dat, unregisters callbacks and timers, removes script-created controls, releases script-owned render textures and fonts and the project-module cache, and removes the dynamic Lua tab when its final control disappears. The next load executes required project modules again.
Callback failures are logged every time they occur. A failing callback remains registered and is invoked again on the next event.
Cleanup has deliberate limits. Arbitrary globals, changes made through FFI, mutations to engine objects, and mutations to shared built-in module tables cannot be reliably rolled back. The standard package library is unavailable.