Skip to content

Sandbox & Limits

Lua chip scripts run in a deterministic sandbox to ensure game stability and prevent abuse.

Instruction Limits

PhaseBudget
Initialization (module-level code)500,000 instructions
Per tick (coroutine + tick + events)50,000 instructions

Exceeding limits triggers a runtime error on the chip (red light on the housing).

Available Libraries

LibraryNotes
mathFull: math.sin, math.floor, math.random, etc.
stringFull: string.format, string.sub, string.find, etc.
tableFull: table.insert, table.remove, table.sort, etc.
coroutineUsed internally by sleep/yield
utf8UTF-8 string handling
os.clockHigh-resolution timer
os.timeCurrent Unix timestamp
os.dateDate/time formatting
os.difftimeTime difference
pcall, xpcallProtected calls
tonumber, tostring, typeStandard conversions
pairs, ipairs, nextTable iteration
select, unpack, rawget, rawsetTable utilities
loadDynamic code loading (from strings only)
util.jsonJSON encode/decode

Blocked Libraries

BlockedReason
ioFilesystem access
packageFilesystem module loading (replaced by require() from data network)
dofile, loadfileFilesystem access
os.execute, os.exit, os.remove, os.renameProcess/filesystem mutation
os.tmpname, os.setlocale, os.getenvSystem interaction

Runtime Behavior

  • Scripts run as Lua coroutines, allowing sleep() and yield() to pause execution
  • Async C# work during tick is rejected — only coroutine suspension is supported
  • print(...) writes to the Lua Debugger Logs tab (per-chip, bounded, cleared on power cycle)
  • File I/O, module loading, and process-affecting operations are disabled

⚠️ This documentation was AI-generated and may contain inaccuracies. Please submit pull requests with corrections as needed.