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
|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.
The above code would produce an output similar to (but not guaranteed to be exactly like) the following:
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.
|void debug.profilebegin ( string label )|
Opens a microprofiler label.
|void debug.profileend ( )|
Closes the top microprofiler label.