Debug

getreg

Returns the current Lua registry table.

Syntax

getreg(): table
Aliases getregistrydebug.getregdebug.getregistry

Returns

NameTypeDescription
registrytableThe current Lua registry table.

Description

Returns the current Lua registry table. The function takes no arguments and returns the registry table directly.

Call it without parameters. The function reads the needed context from the current runtime state.

It returns registry (table). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Return the current Lua registry table.

local registry = getreg()

print(type(registry))
print(type(getregistry()))
print(type(debug.getreg()))
print(type(debug.getregistry()))