aboutsummaryrefslogtreecommitdiff
path: root/lua.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-05 18:15:18 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-05 18:15:18 -0200
commit592a309177edc52847b1196969ad6d49ba21f4fb (patch)
tree06add977885c012ee22cc4f105785c435b6af353 /lua.h
parent413fc7334bf8ceaea71417d73edef15c99d3a793 (diff)
downloadlua-592a309177edc52847b1196969ad6d49ba21f4fb.tar.gz
lua-592a309177edc52847b1196969ad6d49ba21f4fb.tar.bz2
lua-592a309177edc52847b1196969ad6d49ba21f4fb.zip
tag system replaced by event tables
Diffstat (limited to 'lua.h')
-rw-r--r--lua.h36
1 files changed, 12 insertions, 24 deletions
diff --git a/lua.h b/lua.h
index 52179b84..5c63a770 100644
--- a/lua.h
+++ b/lua.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.h,v 1.107 2001/10/31 19:58:11 roberto Exp $ 2** $Id: lua.h,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $
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
@@ -55,15 +55,11 @@ typedef struct lua_State lua_State;
55typedef int (*lua_CFunction) (lua_State *L); 55typedef int (*lua_CFunction) (lua_State *L);
56 56
57 57
58/*
59** an invalid `tag'
60*/
61#define LUA_NOTAG (-1)
62 58
63/* 59/*
64** tags for basic types 60** basic types
65*/ 61*/
66#define LUA_TNONE LUA_NOTAG 62#define LUA_TNONE (-1)
67 63
68#define LUA_TUSERDATA 0 64#define LUA_TUSERDATA 0
69#define LUA_TNIL 1 65#define LUA_TNIL 1
@@ -120,12 +116,11 @@ LUA_API int lua_stackspace (lua_State *L);
120** access functions (stack -> C) 116** access functions (stack -> C)
121*/ 117*/
122 118
123LUA_API const char *lua_type (lua_State *L, int index);
124LUA_API int lua_isnumber (lua_State *L, int index); 119LUA_API int lua_isnumber (lua_State *L, int index);
125LUA_API int lua_isstring (lua_State *L, int index); 120LUA_API int lua_isstring (lua_State *L, int index);
126LUA_API int lua_iscfunction (lua_State *L, int index); 121LUA_API int lua_iscfunction (lua_State *L, int index);
127LUA_API int lua_tag (lua_State *L, int index); 122LUA_API int lua_type (lua_State *L, int index);
128LUA_API int lua_rawtag (lua_State *L, int index); 123LUA_API const char *lua_typename (lua_State *L, int type);
129 124
130LUA_API int lua_equal (lua_State *L, int index1, int index2); 125LUA_API int lua_equal (lua_State *L, int index1, int index2);
131LUA_API int lua_lessthan (lua_State *L, int index1, int index2); 126LUA_API int lua_lessthan (lua_State *L, int index1, int index2);
@@ -155,9 +150,9 @@ LUA_API void lua_getglobal (lua_State *L, const char *name);
155LUA_API void lua_gettable (lua_State *L, int index); 150LUA_API void lua_gettable (lua_State *L, int index);
156LUA_API void lua_rawget (lua_State *L, int index); 151LUA_API void lua_rawget (lua_State *L, int index);
157LUA_API void lua_rawgeti (lua_State *L, int index, int n); 152LUA_API void lua_rawgeti (lua_State *L, int index, int n);
158LUA_API void lua_gettagmethod (lua_State *L, int tag, const char *event);
159LUA_API void lua_newtable (lua_State *L); 153LUA_API void lua_newtable (lua_State *L);
160LUA_API void lua_getweakregistry (lua_State *L); 154LUA_API void lua_getweakregistry (lua_State *L);
155LUA_API void lua_geteventtable (lua_State *L, int objindex);
161 156
162 157
163/* 158/*
@@ -168,7 +163,7 @@ LUA_API void lua_settable (lua_State *L, int index);
168LUA_API void lua_rawset (lua_State *L, int index); 163LUA_API void lua_rawset (lua_State *L, int index);
169LUA_API void lua_rawseti (lua_State *L, int index, int n); 164LUA_API void lua_rawseti (lua_State *L, int index, int n);
170LUA_API void lua_setglobals (lua_State *L); 165LUA_API void lua_setglobals (lua_State *L);
171LUA_API void lua_settagmethod (lua_State *L, int tag, const char *event); 166LUA_API void lua_seteventtable (lua_State *L, int objindex);
172 167
173 168
174/* 169/*
@@ -194,11 +189,6 @@ LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold);
194/* 189/*
195** miscellaneous functions 190** miscellaneous functions
196*/ 191*/
197LUA_API int lua_newtype (lua_State *L, const char *name, int basictype);
198LUA_API void lua_settag (lua_State *L, int tag);
199
200LUA_API int lua_name2tag (lua_State *L, const char *name);
201LUA_API const char *lua_tag2name (lua_State *L, int tag);
202 192
203LUA_API void lua_error (lua_State *L, const char *s); 193LUA_API void lua_error (lua_State *L, const char *s);
204 194
@@ -228,11 +218,11 @@ LUA_API int lua_getweakmode (lua_State *L, int index);
228#define lua_register(L,n,f) (lua_pushcfunction(L, f), lua_setglobal(L, n)) 218#define lua_register(L,n,f) (lua_pushcfunction(L, f), lua_setglobal(L, n))
229#define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0) 219#define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0)
230 220
231#define lua_isfunction(L,n) (lua_rawtag(L,n) == LUA_TFUNCTION) 221#define lua_isfunction(L,n) (lua_type(L,n) == LUA_TFUNCTION)
232#define lua_istable(L,n) (lua_rawtag(L,n) == LUA_TTABLE) 222#define lua_istable(L,n) (lua_type(L,n) == LUA_TTABLE)
233#define lua_isuserdata(L,n) (lua_rawtag(L,n) == LUA_TUSERDATA) 223#define lua_isuserdata(L,n) (lua_type(L,n) == LUA_TUSERDATA)
234#define lua_isnil(L,n) (lua_rawtag(L,n) == LUA_TNIL) 224#define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL)
235#define lua_isnull(L,n) (lua_rawtag(L,n) == LUA_TNONE) 225#define lua_isnull(L,n) (lua_type(L,n) == LUA_TNONE)
236 226
237#define lua_pushliteral(L, s) lua_pushlstring(L, "" s, \ 227#define lua_pushliteral(L, s) lua_pushlstring(L, "" s, \
238 (sizeof(s)/sizeof(char))-1) 228 (sizeof(s)/sizeof(char))-1)
@@ -245,8 +235,6 @@ LUA_API int lua_getweakmode (lua_State *L, int index);
245/* 235/*
246** compatibility macros and functions 236** compatibility macros and functions
247*/ 237*/
248#define lua_newtag(L) lua_newtype(L, NULL, LUA_TNONE)
249#define lua_typename lua_tag2name
250 238
251LUA_API void lua_pushupvalues (lua_State *L); 239LUA_API void lua_pushupvalues (lua_State *L);
252 240