Debugdebug.getcallstackGets the current call stack. Syntax debug.getcallstack(level: number?) -> table Parameters ParameterTypeDescriptionlevelnumber(Optional) Starting level, default 1 Returns TypeDescriptiontableArray of call stack entries Description debug.getcallstack returns information about the current call stack, including function names and source locations. Example local function innerFunc() local stack = debug.getcallstack() for i, entry in ipairs(stack) do print(i, entry.name or "anonymous", entry.source) end end local function outerFunc() innerFunc() end outerFunc() Entry Fields FieldDescriptionnameFunction namesourceSource file/scriptlineCurrent line numberfuncThe function itself Related Functions debug.getinfo - Get info for specific level debug.validlevel - Check if level is valid DebugPrevious Pagedebug.getconstantNext Page