debug.getconstants
Reads a function's constants.
Syntax
Signature
debug.getconstants(FunctionOrLevel: function | number) -> tableAliases
This function has no aliases.
Parameters
| Parameter | Type | Description |
|---|---|---|
FunctionOrLevel | function | number | Luau closure or positive stack level. |
Returns
| Type | Description |
|---|---|
table | Constant slots indexed from 1. Some indexes may be absent. |
Notes
Returns the selected Luau function's constant slots in a table using one-based indexes. Nil, table, and function constants are returned as nil, so the result can have holes. A positive stack level may be used in place of a function.
Example
Luau
local Function = function() local Message = "Hello" return Message end
local Result = debug.getconstants(Function)
print(Result)