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
Description: 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. This function optionally takes
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:
Script '', Line  -  
 - A description of the location where this traceback is being made.
 - The line number of the location where this traceback is being made.
 - The stack’s type.
 - The name of the stack.
Description: Opens a microprofiler label.
Description: Closes the top microprofiler label.