diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-12-05 18:15:18 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-12-05 18:15:18 -0200 |
commit | 592a309177edc52847b1196969ad6d49ba21f4fb (patch) | |
tree | 06add977885c012ee22cc4f105785c435b6af353 /lua.h | |
parent | 413fc7334bf8ceaea71417d73edef15c99d3a793 (diff) | |
download | lua-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.h | 36 |
1 files changed, 12 insertions, 24 deletions
@@ -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; | |||
55 | typedef int (*lua_CFunction) (lua_State *L); | 55 | typedef 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 | ||
123 | LUA_API const char *lua_type (lua_State *L, int index); | ||
124 | LUA_API int lua_isnumber (lua_State *L, int index); | 119 | LUA_API int lua_isnumber (lua_State *L, int index); |
125 | LUA_API int lua_isstring (lua_State *L, int index); | 120 | LUA_API int lua_isstring (lua_State *L, int index); |
126 | LUA_API int lua_iscfunction (lua_State *L, int index); | 121 | LUA_API int lua_iscfunction (lua_State *L, int index); |
127 | LUA_API int lua_tag (lua_State *L, int index); | 122 | LUA_API int lua_type (lua_State *L, int index); |
128 | LUA_API int lua_rawtag (lua_State *L, int index); | 123 | LUA_API const char *lua_typename (lua_State *L, int type); |
129 | 124 | ||
130 | LUA_API int lua_equal (lua_State *L, int index1, int index2); | 125 | LUA_API int lua_equal (lua_State *L, int index1, int index2); |
131 | LUA_API int lua_lessthan (lua_State *L, int index1, int index2); | 126 | LUA_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); | |||
155 | LUA_API void lua_gettable (lua_State *L, int index); | 150 | LUA_API void lua_gettable (lua_State *L, int index); |
156 | LUA_API void lua_rawget (lua_State *L, int index); | 151 | LUA_API void lua_rawget (lua_State *L, int index); |
157 | LUA_API void lua_rawgeti (lua_State *L, int index, int n); | 152 | LUA_API void lua_rawgeti (lua_State *L, int index, int n); |
158 | LUA_API void lua_gettagmethod (lua_State *L, int tag, const char *event); | ||
159 | LUA_API void lua_newtable (lua_State *L); | 153 | LUA_API void lua_newtable (lua_State *L); |
160 | LUA_API void lua_getweakregistry (lua_State *L); | 154 | LUA_API void lua_getweakregistry (lua_State *L); |
155 | LUA_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); | |||
168 | LUA_API void lua_rawset (lua_State *L, int index); | 163 | LUA_API void lua_rawset (lua_State *L, int index); |
169 | LUA_API void lua_rawseti (lua_State *L, int index, int n); | 164 | LUA_API void lua_rawseti (lua_State *L, int index, int n); |
170 | LUA_API void lua_setglobals (lua_State *L); | 165 | LUA_API void lua_setglobals (lua_State *L); |
171 | LUA_API void lua_settagmethod (lua_State *L, int tag, const char *event); | 166 | LUA_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 | */ |
197 | LUA_API int lua_newtype (lua_State *L, const char *name, int basictype); | ||
198 | LUA_API void lua_settag (lua_State *L, int tag); | ||
199 | |||
200 | LUA_API int lua_name2tag (lua_State *L, const char *name); | ||
201 | LUA_API const char *lua_tag2name (lua_State *L, int tag); | ||
202 | 192 | ||
203 | LUA_API void lua_error (lua_State *L, const char *s); | 193 | LUA_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 | ||
251 | LUA_API void lua_pushupvalues (lua_State *L); | 239 | LUA_API void lua_pushupvalues (lua_State *L); |
252 | 240 | ||