aboutsummaryrefslogtreecommitdiff
path: root/lua.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-10-17 19:12:57 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-10-17 19:12:57 -0200
commit1e81da51bab87148981486a84b846399050f4ef2 (patch)
treed2c94326ca096e032d1ae3fa75a5d0605f494cc6 /lua.h
parent7cd37142f404462634a5049a840f572e85c5762b (diff)
downloadlua-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.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/lua.h b/lua.h
index 3ec57716..1325f5f4 100644
--- a/lua.h
+++ b/lua.h
@@ -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);
160LUA_API void lua_rawgeti (lua_State *L, int index, int n); 167LUA_API void lua_rawgeti (lua_State *L, int index, int n);
161LUA_API void lua_getglobals (lua_State *L); 168LUA_API void lua_getglobals (lua_State *L);
162LUA_API void lua_gettagmethod (lua_State *L, int tag, const lua_char *event); 169LUA_API void lua_gettagmethod (lua_State *L, int tag, const lua_char *event);
163LUA_API int lua_getref (lua_State *L, int ref);
164LUA_API void lua_newtable (lua_State *L); 170LUA_API void lua_newtable (lua_State *L);
165LUA_API void lua_getregistry (lua_State *L);
166LUA_API void lua_getweakregistry (lua_State *L); 171LUA_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
265LUA_API void lua_pushupvalues (lua_State *L);
266
257#endif 267#endif
258 268
259 269