fn install_deadline(lua: &Lua, timeout_ms: u64) -> Arc<AtomicBool> ⓘExpand description
Installs a wall-clock deadline on lua, returning the flag its interrupt
sets when the budget runs out.
Luau calls the interrupt at VM instruction boundaries, so a tight loop is
caught; time spent inside a Rust callback or require’s file IO is not.
Returning an error from the interrupt propagates it through whatever the
VM was executing, which is what stops the script.
The flag – not the error message – is what distinguishes a deadline abort from an ordinary script fault, so the two never blur together if the message is ever reworded.
timeout_ms: 0 installs nothing: an explicit opt-out for a trusted
long-running script.