debug
debug
This library provides a few basic functions for debugging code in Roblox. Unlike the debug library found in Lua natively, this version has been heavily sandboxed. Roblox does, however, have debugging functionality similar to Lua’s native debugging functionality (see the DebuggerManager class).
| string debug.traceback ( string message, number level = 1 ) |
|
Returns a traceback of the current function call stack as a string. In other words, a description of the functions that have been called up to this point. The During debugging, debug.traceback answers the question “how did my code get here?” much like an error stack trace, but without stopping the execution of the script. See the example below with several function calls: c() calls b(), b() calls a(), and a() calls debug.traceback. local function a()
print(debug.traceback("Specific moment during a()"))
end
local function b()
a()
end
local function c()
b()
end
a()
The above code would produce an output similar to (but not guaranteed to be exactly like) the following: Specific moment during a() ServerScriptService.Script:2 function a ServerScriptService.Script:6 function b ServerScriptService.Script:10 function c ServerScriptService.Script:13 The format of the returned traceback is not defined and may change at any time; use only for debug diagnostics and error analytics. It’s recommended that you never parse the return value of this function for specific information, such as script names or line numbers. |
| string debug.traceback ( thread thread, string message, number level = 1 ) |
|
‘’ |
| Tuple debug.info ( thread thread, number level, string options ) |
|
Allows programmatic inspection of the call stack.
This function differs from This function is similar to |
| Tuple debug.info ( function function, string options ) |
|
Allows programmatic inspection of the call stack.
This function differs from This function is similar to |
| Tuple debug.info ( number level, string options ) |
|
Allows programmatic inspection of the call stack.
This function differs from This function is similar to |
| void debug.profilebegin ( string label ) |
|
Opens a microprofiler label. |
| void debug.profileend ( ) |
|
Closes the top microprofiler label. |
| debug.setmemorycategory ( string tag ) |
|
Assigns a custom tag name to the current thread’s memory category in the Developer Console. Useful for analyzing memory usage of multiple threads in the same script which would otherwise be grouped together under the same tag/name. |
| debug.resetmemorycategory ( ) |
|
Resets the tag assigned by |