What is StationeersLua?
StationeersLua is a BepInEx mod for Stationeers that brings full Lua 5.2 scripting to programmable chips, replacing the vanilla IC10 assembly language with a modern, powerful scripting language.
Why Lua instead of IC10?
IC10 assembly is powerful but painful at scale:
| IC10 Pain Point | Lua Solution |
|---|---|
16 registers (r0–r15) | Unlimited local variables and tables |
Jump-label spaghetti (j, beq, jal) | if/else, while, for, functions |
| Max 128 lines per chip | No practical line limit (disable in IC10Editor with ? button) |
| No strings (only ASCII-6 packing) | Native string support |
| No data structures | Tables, arrays, maps |
| No error recovery | pcall(), nil-safe reads |
| No inter-chip communication | Full networking: messaging, pub/sub, RPC |
| No code reuse across chips | Library chips with require() |
Key Features
- Full Lua 5.2 Runtime — Standard Lua syntax with loops, functions, tables, closures, coroutines
- Integrated Circuit (Lua) — New chip item that accepts Lua code instead of IC10 assembly
- IC10 Editor Integration - Syntax highlighting, formatting, completions, hover docs, and diagnostics in the in-game code editor
- Comprehensive Device API — Read/write logic values, slots, reagents, memory, batch operations
- Coroutine Support —
sleep()andyield()for natural control flow without mandatorytick()loops - Inter-Chip Networking — Direct messaging, topic-based pub/sub, and RPC between Lua chips
- Library Chips — Write reusable modules loaded via
require()across the data network - Event System — Register handlers for game and mod events
- VS Code Debugger — Attach breakpoints, step execution, inspect stack/scopes/variables, and view runtime output externally
- Wireless Development Access — Reach remote data networks through the wearable wireless development board on supported suits (and Survival Toolbelt chips on the same player)
- Save/Load Persistence —
ic.persiststring KV (save/load and housing power cycles); legacyserialize()/deserialize()still supported - Instruction Limits — Built-in safety limits prevent infinite loops (defaults configurable on the server/host under mod config
[Lua VM]; see Sandbox & Limits) - Multiplayer Compatible — Fully synced across all connected clients
- Server-Authoritative — All execution on the server/host; clients see results via game state sync
- MCP Server — Built-in Model Context Protocol server for AI-aware editors (Cursor, Windsurf, etc.) with chip discovery, code sync, and debug tools
- In-Game Reference Panel — Searchable Lua API reference replaces the IC10 help buttons when editing Lua in the IC editor
- Advanced Computing Compatible — Rack-mounted Lua chips are discovered individually when the Advanced Computing mod is installed
Architecture
┌─────────────┐
│ Code saved │ Editor saves source to chip
└──────┬───────┘
▼
┌─────────────┐
│ Compile/Init │ Lua VM created, ic table injected,
│ │ module-level code runs (default 500K instruction budget)
└──────┬───────┘
▼
┌─────────────┐
│ Tick loop │ Every game tick (~0.5s):
│ │ 1. Network messages processed
│ │ 2. Events dispatched
│ │ 3. Main coroutine resumed
│ │ 4. tick(dt) called if defined
│ │ Budget: default 50K instructions per tick (mod cfg `[Lua VM]`)
└──────┬───────┘
▼
┌─────────────┐
│ Shutdown │ Housing powered off, chip removed, or game exit
└─────────────┘Companion Mods
ScriptedScreens - Build custom touchscreen UIs on computer consoles, tablets, and programmable visors. Buttons, sliders, charts, gauges, canvas drawing, games, media playback, and more - all driven by Lua scripts on ScriptedScreens boards and visor hosts.
