6.10 – The Debug Library

This library provides the functionality of the debug interface (§4.9) to Lua programs. You should exert care when using this library. Several of its functions violate basic assumptions about Lua code (e.g., that variables local to a function cannot be accessed from outside; that userdata metatables cannot be changed by Lua code; that Lua programs do not crash) and therefore can compromise otherwise secure code. Moreover, some functions in this library may be slow.

All functions in this library are provided inside the debug table. All functions that operate over a thread have an optional first argument which is the thread to operate over. The default is always the current thread.

debug.getmetatable()
  • References/Lua/Lua/Standard Libraries/The Debug Library

debug.getmetatable (value) Returns the metatable of the given value or nil if it does not have a metatable.

2025-01-10 15:47:30
debug.traceback()
  • References/Lua/Lua/Standard Libraries/The Debug Library

debug.traceback ([thread,] [message [, level]]) If message is present but is neither a string nor nil, this function returns message without further

2025-01-10 15:47:30
debug.upvaluejoin()
  • References/Lua/Lua/Standard Libraries/The Debug Library

debug.upvaluejoin (f1, n1, f2, n2) Make the n1-th upvalue of the Lua closure f1 refer to the n2-th upvalue of the Lua closure f2

2025-01-10 15:47:30
debug.getregistry()
  • References/Lua/Lua/Standard Libraries/The Debug Library

debug.getregistry () Returns the registry table (see §4.5).

2025-01-10 15:47:30
debug.getuservalue()
  • References/Lua/Lua/Standard Libraries/The Debug Library

debug.getuservalue (u) Returns the Lua value associated to u. If u is not a full userdata, returns nil.

2025-01-10 15:47:30
debug.setupvalue()
  • References/Lua/Lua/Standard Libraries/The Debug Library

debug.setupvalue (f, up, value) This function assigns the value value to the upvalue with index up of the function f. The function returns

2025-01-10 15:47:30
debug.gethook()
  • References/Lua/Lua/Standard Libraries/The Debug Library

debug.gethook ([thread]) Returns the current hook settings of the thread, as three values: the current hook function, the current hook mask, and the current hook count (as set

2025-01-10 15:47:30
debug.setuservalue()
  • References/Lua/Lua/Standard Libraries/The Debug Library

debug.setuservalue (udata, value) Sets the given value as the Lua value associated to the given udata. udata must be a full userdata.

2025-01-10 15:47:30
debug.upvalueid()
  • References/Lua/Lua/Standard Libraries/The Debug Library

debug.upvalueid (f, n) Returns a unique identifier (as a light userdata) for the upvalue numbered n from the given function. These unique identifiers allow

2025-01-10 15:47:30
debug.getupvalue()
  • References/Lua/Lua/Standard Libraries/The Debug Library

debug.getupvalue (f, up) This function returns the name and the value of the upvalue with index up of the function f. The function returns nil

2025-01-10 15:47:30