Execution overlay mapping:M4.SCRIPT.LUA_RUNTIME (P-Core); API surface finalized at M6.MOD.API_STABLE
Deferred features / extensions:LLM global (Phase 7), Workshop global (Phase 6a)
Deferral trigger: Respective milestone start
Canonical for: Lua scripting API surface, OpenRA mission script compatibility, IC extension globals
Scope:ic-script crate, Lua VM integration, 04-MODDING.md
Decision: IC’s Lua API is a strict superset of OpenRA’s 16 global objects. All OpenRA Lua missions run unmodified — same function names, same parameter signatures, same return types. IC adds extension globals (Campaign, Weather, Layer, SubMap, etc.) that do not conflict with any OpenRA name.
Why:
Hundreds of existing OpenRA mission scripts must work without modification
Superset guarantees forward compatibility — new IC globals never shadow existing ones
Modders learn one API; skills transfer between OpenRA and IC
API surface is testable independently of the Lua VM implementation (D004)
Non-goals: Binary compatibility with OpenRA’s C# Lua host. IC uses mlua (Rust); same API surface, different host implementation. Also not a goal: supporting OpenRA’s deprecated or internal-only Lua functions.
Invariants preserved: Deterministic sim (Lua has two write paths, both deterministic: order methods that enqueue PlayerOrders, and trigger-context mutations that execute direct sim writes inside trigger_system() at a fixed pipeline step on every client — see modding/lua-scripting.md § Two Lua Write Paths). Sandbox boundary (resource limits, no filesystem access without capability tokens).
Public interfaces / types / commands: 16 OpenRA globals + 11 IC extension globals (see tables below)
Affected docs:04-MODDING.md § Lua API, modding/campaigns.md (Campaign global examples)
OpenRA globals never change signature. Function names, parameter types, and return types are frozen.
New IC extension globals may be added in any phase. Extension globals never shadow OpenRA names.
Major version bumps (IC 2.0, 3.0, etc.) are the only mechanism for breaking API changes. Within a major version, the API surface is append-only.
The API specification is the contract, not the VM implementation. Switching Lua VM backends (mlua → LuaJIT, Luau, or future alternative) must not change mod script behavior.
The Lua API is defined as an engine-level abstraction independent of the VM implementation. This follows Valve’s Source Engine VScript pattern: the API surface is the stable contract, not the runtime. A mod that calls Actor.Create("tank", pos) depends on the API spec, not on how mlua dispatches the call. WASM mods (Tier 3) access the equivalent API through host functions with identical semantics — prototype in Lua, port to WASM by translating syntax.