Debug
(These are all accessible in the global table, e.g.: getconstant(...))
debug.isvalidlevel
Returns whether level
is a valid level or not.
debug.getregistry
Returns the lua registry.
debug.getconstant
Returns the constant at index
in the constant table of the function or level func
. Throws an error if the constant does not exist.
debug.getconstants
Returns the constant table of the function or level func
.
debug.getinfo
Returns debugger information about a function or stack level.
DebugInfo
source
string
The name of the chunk that created the function.
short_src
string
A "printable" version of source
to be used in error messages.
func
function
The function itself.
what
string
The string "Lua" if the function is a Luau function, or "C" if it is a C function.
currentline
number
The current line where the given function is executing.
name
string
The name of the function.
nups
number
The number of upvalues in the function.
numparams
number
The number of parameters in the function.
is_vararg
number
Whether the function has a variadic argument.
debug.getproto
Returns the proto at index
in the function or level func
if active
is false.
If active
is true, then every active function of the proto is returned.
debug.getprotos
Returns a list of protos of the function or level func
.
debug.getstack
Returns the value at index
in the stack frame level
. Throws an error if no value could be found.
If index
is not specified, then the entire stack frame is returned.
debug.getupvalue
Returns the upvalue at index
in the function or level func
. Throws an error if the upvalue does not exist.
An upvalue is a local variable used by an inner function, and is also called an external local variable.
Read more on Lua visibility rules.
debug.getupvalues
Returns a list of upvalues of the function or level func
.
debug.setconstant
Sets the constant at index
in the function or level func
to value
.
debug.setstack
Sets the register at index
in the stack frame level
to value
.
debug.setupvalue
Sets the upvalue at index
in the function or level func
to value
.
Last updated