debug.info
Inspects function and stack metadata.
Syntax
Signature
debug.info(Target: function | number | thread, OptionsOrLevel: string | number, Options: string?) -> ...anyAliases
This function has no aliases.
Parameters
| Parameter | Type | Description |
|---|---|---|
Target | function | number | thread | Function, stack level, or thread to inspect. |
OptionsOrLevel | string | number | Option string, or stack level when Target is a thread. |
Options | string? | Option string for the thread form. |
Returns
| Type | Description |
|---|---|
...any | Values selected by s, l, n, a, and f. Each option may appear once. |
Notes
Returns values selected by Options in the order of its letters. s returns the source, l the current line, n the name, a the parameter count and vararg flag, and f the function. Use debug.info(Function, Options), debug.info(Level, Options), or debug.info(Thread, Level, Options). An unavailable stack level returns no values.
Example
Luau
local Name, Parameters, Variadic = debug.info(print, "na")
print(Name, Parameters, Variadic)