Repository navigation
Lua API Documentation
Berke edited this page Oct 3, 2026
·
3 revisions
Reference pages for everything you can place in a level and everything a Lua script can touch.
- Getting Started with Scripting walks you from an empty project to a working script, step by step.
- Callback Functions lists every function the engine calls on your scripts, when it calls it and in what order.
| Page | What it is |
|---|---|
| Entity | Anything placed in a level: the player, an enemy, a pickup, a HUD label. It is a name, tags and a set of components. |
| Sector | A room: a 2D shape on the map with floors, ceilings and a light. Sectors can have scripts too. |
| Wall | One edge of a sector. It has a texture and a colour, and it can be a solid wall or an opening to the next sector. |
Components are what give an entity its behaviour. Add them in the entity inspector with Add Component.
| Page | Inspector name | In short |
|---|---|---|
| Transform | Transform | Position, rotation and scale. Nearly every other component needs one. |
| Sprite | Sprite | A flat image in the world: billboards and 4- or 8-direction sprites. |
| Model | Model | A 3D model file (.glb, .gltf, .obj, ...). |
| Audio Source | Audio Source | Plays a sound from the entity's position. |
| Script | Custom Script | Attaches a Lua script. |
| Player Controller | Player Controller | Built-in first-person movement and mouse look. |
| Camera | Camera | Where the game is rendered from. |
| Collider | Collider | A collision shape. It can also be a trigger volume. |
| Rigidbody | Rigidbody | Velocity and gravity, so physics can move the entity. |
| UI Transform | UI Transform | Where a UI element sits on screen. |
| UI Sprite | Image | A picture on the HUD. |
| UI Text | Text | A text label on the HUD. |
Every script can use these globals without setting anything up.
| Page | In short |
|---|---|
| Game | The level as a whole: find entities, find the sector at a point, raycasts. |
| Input | Keyboard and mouse. |
| GameTime |
deltaTime, fixedDeltaTime and the real-world clock. |
| Debug | Print to the in-game console or write to the engine log. |
| Global | A table shared by every script, for game-wide state that survives level changes. |
| mathT | Maths helpers: clamping, interpolation, angles, random numbers, vector maths. |
| Vector2, Vector3, Vector4 | Positions, directions and colours, with + - * /. |
Besides these, a script also gets entity (or sector in a sector script) and Lua's standard
math, string and table libraries. os, io and coroutines are not available.
-
docs/sector.mdis the full Sector scripting API. The Sector page here summarises it and explains what sectors are. -
docs/scripts/has ready-to-use example scripts: doors, lifts, pickups, enemy AI, UI and more.
-
Axes.
xandzare the ground plane andyis up. A map position is aVector2whose.yis the worldz. - Units. Distances are map units. The default player is 12 units tall at the eyes and walks at 46 units per second, so a doorway is about 40 units tall.
-
Colours. Wall, floor, ceiling and sprite colours are
Vector4with channels from0to1. A sector'slightis aVector3with channels from0to255. - Lists are 1-based, as usual in Lua.
- Read-only in a table means scripts can read the value but not change it.