Returns a table describing target, which may be a function or a stack level. what selects which groups of fields to fill in.
Every function on this page is reachable both as debug.<name> and as a plain global of the same name, so debug.getupvalues(f) and getupvalues(f) are the same call.

Parameters

function | number
required
The function to describe, or a stack level.
string
default:"sluanf"
Which fields to include. Each letter adds a group: s source, l current line, u upvalue count, a arity, n name, f the function itself.

Returns

table
A table with the requested fields, or nil when the level does not exist.

Behavior

  • A missing level returns nil rather than raising, so a loop can simply stop when it runs out.
  • Athena’s own frames are not counted when resolving a numeric level, so the levels you see match the script’s own view of the stack.
  • This is the engine’s debug.info grown a table return. Where debug.info hands back loose values, getinfo collects them into fields.

Example

Errors