debug.getinfo
Inspects a function or stack frame.
Syntax
Signature
debug.getinfo(FunctionOrLevel: function | number) -> tableAliases
This function has no aliases.
Parameters
| Parameter | Type | Description |
|---|---|---|
FunctionOrLevel | function | number | Function to inspect or a positive stack level. |
Returns
| Type | Description |
|---|---|
table | Function metadata and the function itself in func. |
Notes
Returns source, short_src, what, name, linedefined, currentline, nups, numparams, is_vararg, and func for a function or positive stack level. is_vararg is stored as a number. Invalid levels raise an error.
Example
Luau
local Result = debug.getinfo(function() return 42 end)
print(Result)