Skip to content

Lua API

PS1Lua exposes a runtime-bound C++ API to game scripts. The binding surface lives in psxsplash-main/src/luaapi.hh and is consumed three ways:

  • In the Godot editor — the PS1Lua language extension reads the same signatures for autocomplete and hover.
  • In external editors (Rider, VS Code) — LuaApiStubGenerator emits EmmyLua stubs from the same source.
  • On this docs site — scripts/py/gen_lua_api_docs.py parses the structured // Namespace.Method(...) comments and writes one page per namespace.

25 namespaces, 174 entries across the surface.

Namespaces

Namespace Entries Page
Animation 1 Animation
Audio 15 Audio
Camera 19 Camera
Controls 4 Controls
Convert 2 Convert
Cutscene 2 Cutscene
Debug 3 Debug
Dialog 3 Dialog
Entity 18 Entity
GameState 7 GameState
Input 4 Input
Interact 2 Interact
Math 14 Math
Music 7 Music
Persist 2 Persist
Physics 3 Physics
Player 4 Player
Random 5 Random
Scene 3 Scene
SkinnedAnim 5 SkinnedAnim
Sound 3 Sound
Stats 10 Stats
Timer 1 Timer
UI 25 UI
Vec3 12 Vec3

Calling convention

All entries are static methods on global tables. From a PS1LuaScript-bound script:

-- Get the camera's current world position
local px, py, pz = Camera.GetPosition()

-- Play a clip; returns the active voice id or nil
local v = Audio.PlaySfx("door_creak")

-- Fixed-point math (PS1 GTE uses Q12.20)
local d = FixedPoint.Mul(velocity, dt)

Coroutines, closures, and standard Lua tables work as normal — the PS1Lua runtime is psyqo-lua atop the PS1's MIPS CPU. No JIT; expect interpreted-Lua speed budgets.