Skip to content
Saiko

debug.getconstants

Returns every constant baked into a function, string literals, numbers and global names.

Signature

luau
debug.getconstants(fn: function | number): { any }

Parameters

fnfunction | number

The function, or a stack level.

Returns

{ any }

Example

luau
local function login()
    return "token-123", 42
end

for index, constant in debug.getconstants(login) do
    print(index, constant)
end