Polyphase Game Engine
Loading...
Searching...
No Matches
Debugger_Lua.h
Go to the documentation of this file.
1#pragma once
2
3#include "EngineTypes.h"
4
5#if LUA_ENABLED
6
7#define DEBUGGER_LUA_NAME "Debugger"
8
9// Script-side bindings for the in-engine Lua debugger.
10//
11// These are registered in BOTH editor and shipping builds so script source
12// stays identical between dev and packaged games. In shipping (non-EDITOR)
13// builds the implementations are silent no-ops and IsAttached returns false.
14struct Debugger_Lua
15{
16 // Debugger.Break([message])
17 // Editor: HARD abort -- aborts the surrounding pcall via lua_error and
18 // freezes the world. The current Lua call stops at this line;
19 // the aborted function does not re-run after Continue. Match
20 // for pdb.set_trace / `debugger;`. Use this for general
21 // "stop here so I can inspect" debugging.
22 // Shipping: silent no-op.
23 static int Break(lua_State* L);
24
25 // Debugger.Snapshot([message])
26 // Editor: SOFT pause -- captures snapshot + freezes the world from the
27 // next frame, but the current Lua call continues to its
28 // natural end. Use this when you want to inspect state inside
29 // a one-shot init function (Awake / Start / SpawnScene flow)
30 // and need the rest of the function to complete -- otherwise
31 // scenes spawned by that function never finish initializing.
32 // Shipping: silent no-op.
33 static int Snapshot(lua_State* L);
34
35 // Debugger.IsAttached() -> bool
36 // Editor: always true.
37 // Shipping: always false.
38 static int IsAttached(lua_State* L);
39
40 static void Bind();
41};
42
43#endif