The debug 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. Feel free to take a look at the
|string debug.traceback ( )|
Returns a traceback of the current stack as a string. The string is identical to the one printed in blue when an error is thrown by a script in Roblox.
The traceback is divided up into several lines, which are separated using the newline character (\n). The first line of the traceback is always Stack Begin, and the last line is always Stack End.
The traceback lines between those two lines are formatted as such:
|void debug.profilebegin ( string label )|
Opens a microprofiler label.
|void debug.profileend ( )|
Closes the top microprofiler label.