Skip to main content

Module debug

Module debug 

Source
Expand description

Debug interface — ported from ldebug.c.

Provides the Lua debug API: stack inspection, source info, variable lookup, hook management, and runtime error formatting.

§C source

reference/lua-5.4.7/src/ldebug.c (962 lines, 30 functions)

Structs§

LuaDebug
Debug introspection record.

Functions§

arg_error_impl
Equivalent of C luaL_argerror: build an arg-type error with function name (from debug info) and caller source location. Handles method calls by producing “calling ‘f’ on bad self …” when arg==1 and namewhat==“method”.
c_api_runtime
get_hook_count
Returns the current hook call count.
get_hook_installed
Returns the current debug hook function, if any.
get_hook_mask
Returns the current hook event mask.
get_info
Returns debug information about a function or active call frame.
get_local
Gets the name and value of local variable n in call frame ar->i_ci (or in the function at the top of the stack if ar is NULL). Pushes the value on the stack and returns its name, or returns None.
get_stack
Fills ar with information about the call frame at depth level. Level 0 is the current running function, level 1 is the caller, etc. Returns true on success, false if the level is out of range.
set_hook
Installs a debug hook on thread state.
set_local
Sets local variable n in call frame ar->i_ci to the value on top of the stack. Pops the value and returns the variable name, or returns None.