Lua sandbox
Scripts get table, string and math — no io, no os, no require, no filesystem, no
network. A scenario script also gets coroutine, runs in a state of its own for every run,
and is stopped when one call runs too long — the budget is in
Scenario scripting. A script sees a context table of numbers and booleans and answers with a table; it
never holds a handle on the simulation. State between calls lives in the script’s own locals,
as in zs1.lua above. A script that raises an error is switched off, and the run continues.
Hooks are called once per frame, not once per simulation step (200 Hz). Keep them cheap anyway — no long loops, cache what you can.