diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-10-17 19:12:57 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-10-17 19:12:57 -0200 |
commit | 1e81da51bab87148981486a84b846399050f4ef2 (patch) | |
tree | d2c94326ca096e032d1ae3fa75a5d0605f494cc6 /lua.h | |
parent | 7cd37142f404462634a5049a840f572e85c5762b (diff) | |
download | lua-1e81da51bab87148981486a84b846399050f4ef2.tar.gz lua-1e81da51bab87148981486a84b846399050f4ef2.tar.bz2 lua-1e81da51bab87148981486a84b846399050f4ef2.zip |
new API for registry and C upvalues + new implementation for references
Diffstat (limited to 'lua.h')
-rw-r--r-- | lua.h | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.103 2001/08/31 19:46:07 roberto Exp $ | 2 | ** $Id: lua.h,v 1.104 2001/10/11 21:41:21 roberto Exp $ |
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 |
@@ -35,6 +35,13 @@ | |||
35 | #define LUA_MULTRET (-1) | 35 | #define LUA_MULTRET (-1) |
36 | 36 | ||
37 | 37 | ||
38 | /* pseudo-index for registry */ | ||
39 | #define LUA_REGISTRYINDEX (-10000) | ||
40 | |||
41 | /* pseudo-indices for upvalues */ | ||
42 | #define lua_upvalueindex(i) (LUA_REGISTRYINDEX-(i)) | ||
43 | |||
44 | |||
38 | /* error codes for `lua_do*' and the like */ | 45 | /* error codes for `lua_do*' and the like */ |
39 | #define LUA_ERRRUN 1 | 46 | #define LUA_ERRRUN 1 |
40 | #define LUA_ERRFILE 2 | 47 | #define LUA_ERRFILE 2 |
@@ -160,9 +167,7 @@ LUA_API void lua_rawget (lua_State *L, int index); | |||
160 | LUA_API void lua_rawgeti (lua_State *L, int index, int n); | 167 | LUA_API void lua_rawgeti (lua_State *L, int index, int n); |
161 | LUA_API void lua_getglobals (lua_State *L); | 168 | LUA_API void lua_getglobals (lua_State *L); |
162 | LUA_API void lua_gettagmethod (lua_State *L, int tag, const lua_char *event); | 169 | LUA_API void lua_gettagmethod (lua_State *L, int tag, const lua_char *event); |
163 | LUA_API int lua_getref (lua_State *L, int ref); | ||
164 | LUA_API void lua_newtable (lua_State *L); | 170 | LUA_API void lua_newtable (lua_State *L); |
165 | LUA_API void lua_getregistry (lua_State *L); | ||
166 | LUA_API void lua_getweakregistry (lua_State *L); | 171 | LUA_API void lua_getweakregistry (lua_State *L); |
167 | 172 | ||
168 | 173 | ||
@@ -246,14 +251,19 @@ LUA_API int lua_getweakmode (lua_State *L, int index); | |||
246 | #define lua_pushliteral(L, s) lua_pushlstring(L, s, \ | 251 | #define lua_pushliteral(L, s) lua_pushlstring(L, s, \ |
247 | (sizeof(s)/sizeof(lua_char))-1) | 252 | (sizeof(s)/sizeof(lua_char))-1) |
248 | 253 | ||
254 | #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX); | ||
255 | |||
256 | #define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, ref) | ||
249 | 257 | ||
250 | 258 | ||
251 | /* | 259 | /* |
252 | ** compatibility macros | 260 | ** compatibility macros and functions |
253 | */ | 261 | */ |
254 | #define lua_newtag(L) lua_newtype(L, NULL, LUA_TNONE) | 262 | #define lua_newtag(L) lua_newtype(L, NULL, LUA_TNONE) |
255 | #define lua_typename lua_tag2name | 263 | #define lua_typename lua_tag2name |
256 | 264 | ||
265 | LUA_API void lua_pushupvalues (lua_State *L); | ||
266 | |||
257 | #endif | 267 | #endif |
258 | 268 | ||
259 | 269 | ||