# TPP Lua reference — environment notes Front matter of the Lua 5.1 scripting reference. These are global facts about the VM that change how every call behaves; read them before using the `lua-functions` lookup table. ``` METAL GEAR SOLID V The Phantom Pain Lua 5.1 Scripting Reference 30/07/2026 1 About this reference Every entry was produced from three sources cross-checked against each other: (1) the Tpp_main_win64 (dev exe) Ghidra decompilation with map symbols, which yields the registered function names, their C symbols and argument/return shapes; (2) the game's own Lua scripts (base game plus every title update), which yield real usage examples and call frequencies; (3) a live game session (gz-lua console bridge), which confirms what actually exists in the VM and resolves proxy modules. Signatures: for engine (C) functions the argument list shows the Lua types the implementation actually reads from the stack (string, number, boolean, table, userdata); '...' means the body could not be paired with a decompiled function. For script-library functions the original parameter names from the shipped source are shown. Purposes: entries marked '(inferred from name)' are mechanical readings of the function name, not verified behavior. Unmarked purpose lines are hand-checked against the wiki, the decompilation, or live calls. Examples: taken verbatim from the game's own scripts (file:line given below each), or marked 'curated' when written and verified for this document. Environment notes: the VM is Lua 5.1 with io, os, debug, and the bit (LuaBIT) library present. Engine modules bound through the luaext binder are lazy __index proxies - iterating them with pairs() returns nothing; call their functions directly. GrTools exists but every function is wired to a dead stub in both retail and dev executables. Daemon/entity modules (TppWeatherManager, TppSoundDaemon, UiDaemon, PhDaemon...) expose member functions that take the instance as their first argument: get it with Module.GetInstance(), then call inst:Fn() or Module.Fn(inst, ...). Calling them bare raises 'Entity expected' (verified live). Quick start -- resolve an object and send it a command local id = GameObject.GetGameObjectId("TppPlayer2") GameObject.SendCommand(id, { id = "RequestLoadReticleParameter" }) -- hash a string the way the engine does Fox.StrCode32("Spawn") -- 0xdf2005c4 -- put text in the announce log / iDroid LOG (verified live) TppUiCommand.AnnounceLogView("hello snake") -- console note: statements print nothing; evaluate a bare -- expression (no 'local') or use return to see values About this reference 2 Contents About this reference 2 ```