Debug
(These are all accessible in the global table, e.g.: getconstant(...))
debug.isvalidlevel
<boolean> debug.isvalidlevel(<number> level)
Returns whether level
is a valid level or not.
debug.getregistry
<table<function | thread>> debug.getregistry()
Returns the lua registry.
debug.getconstant
<any> debug.getconstant(<function | number> func, <number> index)
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
<table<any>> debug.getconstants(<function | number> func)
Returns the constant table of the function or level func
.
debug.getinfo
<DebugInfo> debug.getinfo(<function | number> func)
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
<function | table<function>> debug.getproto(<function | number> func, <number> index, <boolean?> active)
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
<table<function>> debug.getprotos(<function | number> func)
Returns a list of protos of the function or level func
.
debug.getstack
<any | table<any>> debug.getstack(<function | number> func, <number?> index)
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
<any> debug.getupvalue(<function | number> func, <number> index)
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
<table<any>> debug.getupvalues(<function | number> func)
Returns a list of upvalues of the function or level func
.
debug.setconstant
<nil> debug.setconstant(<function | number> func, <number> index, <any> value)
Sets the constant at index
in the function or level func
to value
.
debug.setstack
<nil> debug.setstack(<function | number> func, <number> index, <any> value)
Sets the register at index
in the stack frame level
to value
.
debug.setupvalue
<nil> debug.setupvalue(<function | number> func, <number> index, <any> value)
Sets the upvalue at index
in the function or level func
to value
.
Last updated