Garry's Mod Wiki


  table debug.getregistry()


Returns the internal Lua registry table.

The Lua registry is used by the engine and binary modules to create references to Lua values. The registry contains every global ran and used in the Lua environment. Avoid creating entries into the registry with a number as the key, as they are reserved for the reference system.

Improper editing of the registry can result in unintended side effects, including crashing the game.


1 table
The Lua registry


Let's try to find the global table (_G) inside the registry (_R).

local _R = debug.getregistry() MsgN(_R._LOADED._G) -- _LOADED contains most things ran in Lua, but there are all sorts of other interesting tables inside of the registry. MsgN(_R._LOADED._G == _G)
table: 0xcece1d62 true