ReferenceDebug

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

ParameterTypeDescription
threadthread?Optional thread to inspect.
messagestring?Text preceding the trace.
levelnumber?Starting caller level.

Returns

TypeDescription
stringFormatted 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.