debug. getconstants Synchronous
getconstants
Read all constant slots from a Luau function at once. It is useful when exploring a compiled function without guessing which slot contains a literal.
Luau
debug.getconstants(target: DebugTarget) -> {[number]: any}Parameters
| Parameter | Type | Description |
|---|---|---|
target | DebugTarget | A Luau function, visible stack level, or ProtoProxy. Indexes in these APIs start at 1. |
Argument fields
Luau
DebugTarget = Function | number | ProtoProxyReturns
{[number]: any}A table indexed by constant slot; nil constants may leave holes.
Example
Luau
local function label() return "ready" end
for index, value in pairs(debug.getconstants(label)) do
print(index, value)
end