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_refusage is present.
Example
Count the non-Athena registry entries:Errors
getreg does not raise under normal conditions.