debug.info

Inspects function and stack metadata.

Syntax

Signature
debug.info(Target: function | number | thread, OptionsOrLevel: string | number, Options: string?) -> ...any

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
Targetfunction | number | threadFunction, stack level, or thread to inspect.
OptionsOrLevelstring | numberOption string, or stack level when Target is a thread.
Optionsstring?Option string for the thread form.

Returns

TypeDescription
...anyValues 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)