Debug Library
Functions
validlevel
bool debug.validlevel(level: int, t?: thread)
Checks if level is a valid index level for the current thread or t if passed.
getcallstack
table debug.getcallstack(t?: thread)
Returns a table with each index having fields for the func being executed at that call stack level, and the currentline if it is a Lua closure. Uses t instead of the callers thread if one is passed.
getprotos
table debug.getprotos(f: function | int | ProtoProxy)
Returns a table containing the inner prototypes of function f. Use debug.getproto with activated set to true to get a list of closures.
getproto
table | ProtoProxy debug.getproto(f: function | int | ProtoProxy, index?: int, activated?: bool)
Gets the inner function of f at index.
Note: If activated is true, it instead will return a table of functions. These are the closures of that proto that exist within the GC.
getstack
any debug.getstack(level: int, index?: int)
Gets the method stack at level index. If index is not provided, a table is returned.
setstack
void debug.setstack(level: int, index: int, value: any)
Sets a stack value at index for function at level to value.
getupvalues
table debug.getupvalues(fi: function | int)
Retrieve the upvalues in function fi or at level fi.
getupvalue
any debug.getupvalue(fi: function | int, index: int)
Returns the upvalue with index idx in function or level fi.
setupvalue
void debug.setupvalue(fi: function | int, index: int, value: any)
Sets an upvalue at index idx in function or level fi.
getconstants
table debug.getconstants(f: function | int | ProtoProxy, pseudo_indices?: bool = False)
Retrieve the constants in function fi or at level fi.
getconstant
any debug.getconstant(f: function | int | ProtoProxy, index: int)
Returns the constant at index idx in function fi or level fi.
setconstant
any debug.setconstant(f: function | int | ProtoProxy, index: int, value: any, pseudo_indices?: bool = False)
Set constant idx to tuple value at level or function fi.
getmetatable
table debug.getmetatable(t: table)
Equivalent to getrawmetatable.
setmetatable
void debug.setmetatable(t: table, mt: table)
Equivalent to setrawmetatable.
getregistry
table debug.getregistry()
Equivalent to getreg.