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.

Syntax
Luau
debug.getinfo(target: DebugTarget) -> DebugInfo

Parameters

Function parameters
ParameterTypeDescription
targetDebugTargetA Luau function, visible stack level, or ProtoProxy. Indexes in these APIs start at 1.

Argument fields

DebugTarget fields
Luau
DebugTarget = Function | number | ProtoProxy

Returns

DebugInfo

A DebugInfo table with fields such as name, source, short_src, currentline, numparams, nups, is_vararg, and func.

DebugInfo fields
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

Example
Luau
local function format(value) return tostring(value) end
local info = debug.getinfo(format)
print(info.source, info.numparams)
Kawaii documentation