debug.getinfo
Returns debug information. Global: getinfo.
Syntax
debug.getinfo(funcOrLevel: function | number) -> any
Parameters
| Parameter | Type | Description |
|---|---|---|
funcOrLevel | function | number | The func or level value used by the call. |
Returns
| Type | Description |
|---|---|
any | Debug information |
Description
debug.getinfo is part of the Debug library. The debug library exposes the internals of the active Luau state, including protos, constants, upvalues and stack frames.
The call is read-only: it resolves the current value when invoked and does not change the underlying state.
Example
local info = debug.getinfo(print)
print(info.name, info.what, info.source)
Notes
- Writing protos, constants or upvalues can corrupt a running function; test changes carefully.