debug
Documentation of Synapse Z debug library
debug.getconstants
table<any> debug.getconstants(target: <number/function>)
gets constants of a lua function passed at target or number stack level
debug.getconstant
any debug.getconstant(target: <number/function>, index: number)
gets constant of a lua function passed at target or number stack level (uses lua based indexing)
debug.setconstant
void debug.setconstant(target: <number/function>, index: number, value: any)
sets constant of a lua function passed at target or number stack level (uses lua based indexing)
debug.getupvalues
table<any> debug.getupvalues(target: <number/function>)
gets upvalues of a lua function passed at target or number stack level
debug.getupvalue
any debug.getupvalue(target: <number/function>, index: number)
gets upvalue of a lua function passed at target or number stack level (uses lua based indexing)
debug.setupvalue
void debug.setupvalue(target: <number/function>, index: number, value: any)
sets upvalue of a lua function passed at target or number stack level (uses lua based indexing)
debug.getprotos
table<function> debug.getprotos(target: <number/function>)
gets protos of a lua function passed at target or number stack level
debug.getproto
<function/table<function>> debug.getproto(target: <number/function>, index: number, active: bool?)
gets proto of a lua function passed at target or number stack level (uses lua based indexing)
if active is true returns a list of all loaded functions with the proto
debug.getstack
<any/table<any>> debug.getstack(stack_level: number, index: number?)
gets full stack or a single element of the stack on stack_level if index is provided
debug.setstack
void debug.setstack(stack_level: number, index: number, value: any)
sets a value of the stack on stack_level
debug.getinfo
table debug.getinfo(target: <number/function>, options: string?)
gets info of target function or target call stack function
return value is a table of this prototype:
Field | Type | Option | Description |
---|---|---|---|
func | function | f | the target function / the function on the callstack |
linedefined | number | l | the line that the function was defined on |
currentline | number | l | current line that the function is executing |
name | string | n | the name of the function |
source | string | s | the chunkname where the function was made |
short_src | string | s | the shortened chunkname where the function was made |
what | string | s | Lua/C depending on whenever the function is lua or not |
numparams | number | u | number of function parameters |
is_vararg | number | u | whenever the function is variadic or not |
nups | number | u | number of function upvalues |
debug.getcallstack
table<function> debug.getcallstack(start_level: number?)
returns the whole callstack or the callstack before start_level if specified
debug.isvalidlevel
bool debug.isvalidlevel(stack_level: number)
returns whenever the stack level is valid or not