Garry's Mod Wiki

Garry's Mod Wiki

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

Description

We advise against using this. It may be changed or removed in a future update.

Returns a full execution stack trace.

Arguments

1 thread thread = current thread
Thread (ie. error object from xpcall error handler) to build traceback for. If this argument is not set to a proper thread it will act as the next argument.
2 string message = nil
Appended at the beginning of the traceback.
3 number level = 1
Which level to start the traceback.

Returns

1 string
A dump of the execution stack.

Example

Prints the traceback into console.

Output: > print(debug.traceback())... stack traceback:
lua_run:1: in main chunk

Example

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

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...