Skip to content

Lua scripting

Drive a Tick UI screen from a live Lua script instead of C#. The script is the per-frame UI body. Tick UI recompiles it when it changes and re-runs it every frame. This powers the web playground and is equally usable in a shipped game for UI modding, data-driven HUDs, or any user-generated interface.

This layer is optional and off by default. It lives in a separate assembly (interludesoftware.tick.scripting) gated behind the TICK_LUA compile flag. It embeds MoonSharp, a pure-C# Lua interpreter that runs under IL2CPP. MoonSharp therefore works in WebGL and other ahead-of-time players, where no runtime C# compiler exists. A project that does not enable it pulls in no extra dependencies and is unaffected. The assembly is excluded from compilation, and nothing in the core package references it.

The pages in this section:

  • Configure Lua support: install MoonSharp, set the TICK_LUA define, and prepare IL2CPP and WebGL builds.
  • Run your first Lua script: host the runner in a BaseGameUI subclass, write a script, hot-reload it, surface errors, and pass game state in safely.

For the compile flag itself, refer to Compile flags.