ReferenceEnvironment

getreg

Returns the Luau registry, the table the engine uses to keep values alive on its own behalf.

Syntax

getreg() -> table

Also available as

getregistrydebug.getregistryget_regget_registry

Returns

TypeDescription
tableThe Luau registry table.

Description

The registry holds the game's threads, functions referenced by the engine, signal callbacks and other internal values. It is mostly useful for finding things no global or script variable points to.

Example

local threads = 0
for _, value in getreg() do
    if type(value) == "thread" then
        threads += 1
    end
end
print(threads, "threads in the registry")

Notes

These are Game executor contracts. Check build requirements and session lifetimes before using them.