debug.traceback
Formats the current call stack without throwing an error.
Syntax
debug.traceback(message: string?, level: number?) -> string
debug.traceback(thread: thread, message: string?, level: number?) -> string
Parameters
| Parameter | Type | Description |
|---|---|---|
thread | thread? | Optional thread to inspect. |
message | string? | Text preceding the trace. |
level | number? | Starting caller level. |
Returns
| Type | Description |
|---|---|
string | Formatted stack trace. |
Description
Message is an optional first line and level selects where the trace begins. A thread can be supplied first to inspect its stack. Apex keeps the game’s traceback format while omitting explicitly hidden frames. The result is diagnostic text; use debug.info for structured fields rather than parsing line formatting.
Example
local function sample()
print(debug.traceback("Example trace"))
end
sample()
These are Game executor contracts. Check build requirements and session lifetimes before using them.
