debuglib¶
debug¶
Enters an interactive mode with the user, running each string that the user enters.
getfenv¶
Returns the environment of object o
.
gethook¶
Returns the current hook settings of the thread.
getinfo¶
function debug.getinfo(thread: thread, f: integer|fun(...any):...unknown, what?: string|"L"|"S"|"f"|"l"...(+4))
-> debuginfo
Returns a table with information about a function.
what:
+> "n" -- `name` and `namewhat`
+> "S" -- `source`, `short_src`, `linedefined`, `lastlinedefined`, and `what`
+> "l" -- `currentline`
+> "t" -- `istailcall`
+> "u" -- `nups`, `nparams`, and `isvararg`
+> "f" -- `func`
+> "r" -- `ftransfer` and `ntransfer`
+> "L" -- `activelines`
getlocal¶
function debug.getlocal(thread: thread, f: integer|fun(...any):...unknown, index: integer)
-> name: string
2. value: any
Returns the name and the value of the local variable with index local
of the function at level f
of the stack.
getmetatable¶
Returns the metatable of the given value.
getregistry¶
Returns the registry table.
getupvalue¶
Returns the name and the value of the upvalue with index up
of the function.
getuservalue¶
Returns the n
-th user value associated
to the userdata u
plus a boolean,
false
if the userdata does not have that value.
setcstacklimit¶
Deprecated in Lua 5.4.2
¶
Sets a new limit for the C stack. This limit controls how deeply nested calls can go in Lua, with the intent of avoiding a stack overflow.
In case of success, this function returns the old limit. In case of error, it returns false
.
setfenv¶
Sets the environment of the given object
to the given table
.
sethook¶
function debug.sethook(thread: thread, hook: fun(...any):...unknown, mask: string|"c"|"l"|"r", count?: integer)
Sets the given function as a hook.
mask:
+> "c" -- Calls hook when Lua calls a function.
+> "r" -- Calls hook when Lua returns from a function.
+> "l" -- Calls hook when Lua enters a new line of code.
setlocal¶
Assigns the value
to the local variable with index local
of the function at level
of the stack.
setmetatable¶
Sets the metatable for the given value to the given table (which can be nil
).
setupvalue¶
Assigns the value
to the upvalue with index up
of the function.
setuservalue¶
Sets the given value
as
the n
-th user value associated to the given udata
.
udata
must be a full userdata.
traceback¶
Returns a string with a traceback of the call stack. The optional message string is appended at the beginning of the traceback.
upvalueid¶
Returns a unique identifier (as a light userdata) for the upvalue numbered n
from the given function.
upvaluejoin¶
function debug.upvaluejoin(f1: fun(...any):...unknown, n1: integer, f2: fun(...any):...unknown, n2: integer)
Make the n1
-th upvalue of the Lua closure f1
refer to the n2
-th upvalue of the Lua closure f2
.