PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

debug

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 DebuggerManager class.

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.

Format

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 '[1]', Line [2] - [3] [4]

[1] - A description of the location where this traceback is being made.
[2] - The line number of the location where this traceback is being made.
[3] - The stack’s type.
[4] - The name of the stack.

void debug.profilebegin ( string label )

Opens a microprofiler label.

void debug.profileend ( )

Closes the top microprofiler label.