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:

FieldTypeOptionDescription
funcfunctionfthe target function / the function on the callstack
linedefinednumberlthe line that the function was defined on
currentlinenumberlcurrent line that the function is executing
namestringnthe name of the function
sourcestringsthe chunkname where the function was made
short_srcstringsthe shortened chunkname where the function was made
whatstringsLua/C depending on whenever the function is lua or not
numparamsnumberunumber of function parameters
is_varargnumberuwhenever the function is variadic or not
nupsnumberunumber 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