Garry's Mod Wiki


string debug.traceback( thread thread = current thread, number level = 1, string message = "nil" )


Returns a full execution stack trace.


1 thread thread = current thread
Thread (ie. error object from xpcall error handler) to build traceback for.
2 number level = 1
Which level to start the traceback.
3 string message = "nil"
Appended at the beginning of the traceback.


1 string
A dump of the execution stack.


Prints the traceback into console.

Output: > print(debug.traceback())... stack traceback:

lua_run:1: in main chunk


Defines two functions that are later visible in the traceback. Enter "lua_run TracebackTest()" into the development console to achieve exact results.

function TracebackTest() AnotherTracebackFunction() end function AnotherTracebackFunction() print(debug.traceback()) end
Output: stack traceback:

lua_run:1: in function 'AnotherTracebackFunction' lua_run:1: in function 'TracebackTest' lua_run:1: in main chunk

Page Links

Special Pages



Render Time: 38ms

DB GetPage 3
Generate Html 7
SaveChanges (1) 12
Render Body 0
Render Sidebar 13