summaryrefslogtreecommitdiff
path: root/lua.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-04-17 14:35:54 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-04-17 14:35:54 -0300
commitbeee01b170c5fea9ed4527b28b9221d2df1baaba (patch)
tree82263b6e128ffe09fe3da63de16c626522320dfc /lua.h
parent6473f965ca699719b3b9908008f15da48cc2e6f1 (diff)
downloadlua-beee01b170c5fea9ed4527b28b9221d2df1baaba.tar.gz
lua-beee01b170c5fea9ed4527b28b9221d2df1baaba.tar.bz2
lua-beee01b170c5fea9ed4527b28b9221d2df1baaba.zip
re-implementation of refs through weak tables
Diffstat (limited to 'lua.h')
-rw-r--r--lua.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/lua.h b/lua.h
index 313a32be..4bfbc336 100644
--- a/lua.h
+++ b/lua.h
@@ -1,8 +1,8 @@
1/* 1/*
2** $Id: lua.h,v 1.94 2001/04/11 14:42:41 roberto Exp roberto $ 2** $Id: lua.h,v 1.95 2001/04/11 18:39:37 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: lua@tecgraf.puc-rio.br 5** e-mail: info@lua.org
6** www: http://www.lua.org 6** www: http://www.lua.org
7** See Copyright Notice at the end of this file 7** See Copyright Notice at the end of this file
8*/ 8*/
@@ -29,24 +29,20 @@
29/* pre-defined references */ 29/* pre-defined references */
30#define LUA_NOREF (-2) 30#define LUA_NOREF (-2)
31#define LUA_REFNIL (-1) 31#define LUA_REFNIL (-1)
32#define LUA_REFREGISTRY 0
33
34/* pre-defined tags */
35#define LUA_NOTAG (-2)
36 32
37 33
38/* option for multiple returns in lua_call */ 34/* option for multiple returns in `lua_call' */
39#define LUA_MULTRET (-1) 35#define LUA_MULTRET (-1)
40 36
41 37
42/* error codes for lua_do* */ 38/* error codes for `lua_do*' and the like */
43#define LUA_ERRRUN 1 39#define LUA_ERRRUN 1
44#define LUA_ERRFILE 2 40#define LUA_ERRFILE 2
45#define LUA_ERRSYNTAX 3 41#define LUA_ERRSYNTAX 3
46#define LUA_ERRMEM 4 42#define LUA_ERRMEM 4
47#define LUA_ERRERR 5 43#define LUA_ERRERR 5
48 44
49/* weak modes */ 45/* weak-table modes */
50#define LUA_WEAK_KEY 1 46#define LUA_WEAK_KEY 1
51#define LUA_WEAK_VALUE 2 47#define LUA_WEAK_VALUE 2
52 48
@@ -67,6 +63,11 @@ typedef int (*lua_CFunction) (lua_State *L);
67#define LUA_TTABLE 4 63#define LUA_TTABLE 4
68#define LUA_TFUNCTION 5 64#define LUA_TFUNCTION 5
69 65
66/*
67** an invalid `tag'
68*/
69#define LUA_NOTAG (-2)
70
70 71
71 72
72/* 73/*
@@ -77,7 +78,7 @@ typedef int (*lua_CFunction) (lua_State *L);
77#endif 78#endif
78 79
79 80
80/* minimum stack available for a C function */ 81/* minimum Lua stack available to a C function */
81#define LUA_MINSTACK 20 82#define LUA_MINSTACK 20
82 83
83 84
@@ -163,6 +164,8 @@ LUA_API void lua_getglobals (lua_State *L);
163LUA_API void lua_gettagmethod (lua_State *L, int tag, const lua_char *event); 164LUA_API void lua_gettagmethod (lua_State *L, int tag, const lua_char *event);
164LUA_API int lua_getref (lua_State *L, int ref); 165LUA_API int lua_getref (lua_State *L, int ref);
165LUA_API void lua_newtable (lua_State *L); 166LUA_API void lua_newtable (lua_State *L);
167LUA_API void lua_getregistry (lua_State *L);
168LUA_API void lua_getweakregistry (lua_State *L);
166 169
167 170
168/* 171/*
@@ -241,8 +244,6 @@ LUA_API int lua_getweakmode (lua_State *L, int index);
241#define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL) 244#define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL)
242#define lua_isnull(L,n) (lua_type(L,n) == LUA_TNONE) 245#define lua_isnull(L,n) (lua_type(L,n) == LUA_TNONE)
243 246
244#define lua_getregistry(L) lua_getref(L, LUA_REFREGISTRY)
245
246#define lua_pushliteral(L, s) lua_pushlstring(L, s, \ 247#define lua_pushliteral(L, s) lua_pushlstring(L, s, \
247 (sizeof(s)/sizeof(lua_char))-1) 248 (sizeof(s)/sizeof(lua_char))-1)
248 249