debug. getinfo Synchronous
getinfo
Get a structured description of a function, stack frame, or ProtoProxy. Use it to see source, line, parameter, and upvalue information in one call.
Luau
debug.getinfo(target: DebugTarget) -> DebugInfoParameters
| Parameter | Type | Description |
|---|---|---|
target | DebugTarget | A Luau function, visible stack level, or ProtoProxy. Indexes in these APIs start at 1. |
Argument fields
Luau
DebugTarget = Function | number | ProtoProxyReturns
DebugInfoA DebugInfo table with fields such as name, source, short_src, currentline, numparams, nups, is_vararg, and func.
Luau
DebugInfo = {
name: string?, source: string?, short_src: string?, what: string?,
currentline: number?, nups: number?, numparams: number?,
is_vararg: number?, func: Function | ProtoProxy?
}Usage notes
Fields can be nil when unavailable, such as the active line for an inactive prototype.
Example
Luau
local function format(value) return tostring(value) end
local info = debug.getinfo(format)
print(info.source, info.numparams)