Garry's Mod Wiki

Revision Difference

debug.getregistry#552523

<function name="getregistry" parent="debug" type="libraryfunc"> <description> 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. <warning>Improper editing of the registry can result in unintended side effects, including crashing of the game.</warning> <warning>Improper editing of the registry can result in unintended side effects, including crashing the game.</warning> </description> <realm>Shared and Menu</realm> <rets> <ret name="" type="table">The Lua registry</ret> </rets> </function> <example> <description>Let's see about trying to find the global table (_G) inside the registry (_R).</description> <description>Let's try to find the global table (_G) inside the registry (_R).</description> <code> local _R = debug.getregistry() MsgN(_R._LOADED._G) -- _LOADED contains mots things ran in Lua, there is other interesting tables inside of the registry. 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) </code> <output> ``` table: 0xcece1d62 true ``` </output> </example>