debug.getregistry
From GMod Wiki
Function | |
Syntax |
debug.getregistry( ) Where is this used? |
Description: | |
Returns the registry table. | |
Returns: | Table |
Part of Library: | Debug |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Debug.getregistry]Debug.getregistry [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Detailed Description
(from the Lua 5.1 reference manual)
Lua provides a registry, a pre-defined table that can be used by any C code to store whatever Lua value it needs to store. This table is always located at pseudo-index LUA_REGISTRYINDEX. Any C library can store data into this table, but it should take care to choose keys different from those used by other libraries, to avoid collisions. Typically, you should use as key a string containing your library name or a light userdata with the address of a C object in your code.
The integer keys in the registry are used by the reference mechanism, implemented by the auxiliary library, and therefore should not be used for other purposes.
Note
In Garry's Mod, the registry is also accessible through the global variable _R, which is the preferred way to access it.