diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-10-31 17:58:11 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-10-31 17:58:11 -0200 |
| commit | af59848219abcab589ac174c829102ed8a2adc8d (patch) | |
| tree | 3deabe4b29f255013ae2fe83553ffa48f578d90d /lua.h | |
| parent | 46347d768e571ba9b36581c36d11d2de1dee2cfb (diff) | |
| download | lua-af59848219abcab589ac174c829102ed8a2adc8d.tar.gz lua-af59848219abcab589ac174c829102ed8a2adc8d.tar.bz2 lua-af59848219abcab589ac174c829102ed8a2adc8d.zip | |
tables of globals accessible through pseudo-index in C API
Diffstat (limited to 'lua.h')
| -rw-r--r-- | lua.h | 13 |
1 files changed, 7 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.105 2001/10/17 21:12:57 roberto Exp $ | 2 | ** $Id: lua.h,v 1.106 2001/10/31 19:40:14 roberto Exp roberto $ |
| 3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
| 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil | 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil |
| 5 | ** e-mail: info@lua.org | 5 | ** e-mail: info@lua.org |
| @@ -30,11 +30,12 @@ | |||
| 30 | #define LUA_MULTRET (-1) | 30 | #define LUA_MULTRET (-1) |
| 31 | 31 | ||
| 32 | 32 | ||
| 33 | /* pseudo-index for registry */ | 33 | /* |
| 34 | ** pseudo-indices | ||
| 35 | */ | ||
| 34 | #define LUA_REGISTRYINDEX (-10000) | 36 | #define LUA_REGISTRYINDEX (-10000) |
| 35 | 37 | #define LUA_GLOBALSINDEX (-10001) | |
| 36 | /* pseudo-indices for upvalues */ | 38 | #define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) |
| 37 | #define lua_upvalueindex(i) (LUA_REGISTRYINDEX-(i)) | ||
| 38 | 39 | ||
| 39 | 40 | ||
| 40 | /* error codes for `lua_do*' and the like */ | 41 | /* error codes for `lua_do*' and the like */ |
| @@ -160,7 +161,6 @@ LUA_API void lua_getglobal (lua_State *L, const lua_char *name); | |||
| 160 | LUA_API void lua_gettable (lua_State *L, int index); | 161 | LUA_API void lua_gettable (lua_State *L, int index); |
| 161 | LUA_API void lua_rawget (lua_State *L, int index); | 162 | LUA_API void lua_rawget (lua_State *L, int index); |
| 162 | LUA_API void lua_rawgeti (lua_State *L, int index, int n); | 163 | LUA_API void lua_rawgeti (lua_State *L, int index, int n); |
| 163 | LUA_API void lua_getglobals (lua_State *L); | ||
| 164 | LUA_API void lua_gettagmethod (lua_State *L, int tag, const lua_char *event); | 164 | LUA_API void lua_gettagmethod (lua_State *L, int tag, const lua_char *event); |
| 165 | LUA_API void lua_newtable (lua_State *L); | 165 | LUA_API void lua_newtable (lua_State *L); |
| 166 | LUA_API void lua_getweakregistry (lua_State *L); | 166 | LUA_API void lua_getweakregistry (lua_State *L); |
| @@ -244,6 +244,7 @@ LUA_API int lua_getweakmode (lua_State *L, int index); | |||
| 244 | (sizeof(s)/sizeof(lua_char))-1) | 244 | (sizeof(s)/sizeof(lua_char))-1) |
| 245 | 245 | ||
| 246 | #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX); | 246 | #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX); |
| 247 | #define lua_getglobals(L) lua_pushvalue(L, LUA_GLOBALSINDEX); | ||
| 247 | 248 | ||
| 248 | 249 | ||
| 249 | 250 | ||
