Returns a snapshot of the Luau registry, the internal table the VM uses to hold references that are not reachable from Lua in the normal way, such as live lua_ref handles.

Returns

table
A new table containing the registry’s current entries, with Athena’s own references removed.

Behavior

getreg returns a sanitized snapshot, not the live registry table. That’s a deliberate choice, and it matters when you reason about what you’re looking at:
  • It is a copy. The returned table is built fresh at call time. Mutating it does not change the real registry, and entries added to the real registry after your call will not appear in a table you already hold. Call again for a current view.
  • Athena’s references are stripped. Reference slots that Athena owns are omitted from the snapshot, so iterating it does not expose the environment’s internal handles to the script. Every entry that belongs to the game or to your own lua_ref usage is present.
If you need the registry to look up something the game registered (a pinned callback, a cached object), the snapshot contains it. If you expected to find Athena’s internal bookkeeping, that is intentionally absent.

Example

Count the non-Athena registry entries:

Errors

getreg does not raise under normal conditions.