Volt

getreg

Returns the Lua registry table.

Syntax

getreg() -> table

Returns

TypeDescription
tableThe Lua registry

Description

getreg returns the Lua registry, a special table used internally by Lua to store references. This can contain connections, threads, and other internal objects.

Example

local registry = getreg()

for i, v in pairs(registry) do
    print(i, type(v), v)
end

Finding Connections

-- Find all RBXScriptConnections in the registry
local connections = {}
for _, v in pairs(getreg()) do
    if type(v) == "table" then
        for _, item in pairs(v) do
            local t = typeof(item)
            if t == "RBXScriptConnection" then
                table.insert(connections, item)
            end
        end
    end
end
print("Found", #connections, "connections")

Notes

  • The registry contains internal Lua objects
  • Modifying the registry can cause undefined behavior
  • Use with caution and primarily for reading

On this page