diff options
Diffstat (limited to '')
| -rw-r--r-- | lapi.c | 5 | ||||
| -rw-r--r-- | lbuiltin.c | 16 | ||||
| -rw-r--r-- | lua.h | 8 |
3 files changed, 15 insertions, 14 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 1.50 1999/09/21 16:10:13 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.51 1999/10/04 17:51:04 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -216,6 +216,9 @@ void lua_rawsetglobal (const char *name) { | |||
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | 218 | ||
| 219 | const char *lua_type (lua_Object o) { | ||
| 220 | return (o == LUA_NOOBJECT) ? "NOOBJECT" : luaO_typename(Address(o)); | ||
| 221 | } | ||
| 219 | 222 | ||
| 220 | int lua_isnil (lua_Object o) { | 223 | int lua_isnil (lua_Object o) { |
| 221 | return (o!= LUA_NOOBJECT) && (ttype(Address(o)) == LUA_T_NIL); | 224 | return (o!= LUA_NOOBJECT) && (ttype(Address(o)) == LUA_T_NIL); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbuiltin.c,v 1.63 1999/09/20 14:57:29 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.c,v 1.64 1999/10/04 17:51:04 roberto Exp roberto $ |
| 3 | ** Built-in functions | 3 | ** Built-in functions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -247,6 +247,13 @@ static void luaB_collectgarbage (void) { | |||
| 247 | lua_pushnumber(lua_collectgarbage(luaL_opt_int(1, 0))); | 247 | lua_pushnumber(lua_collectgarbage(luaL_opt_int(1, 0))); |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | |||
| 251 | static void luaB_type (void) { | ||
| 252 | lua_Object o = luaL_nonnullarg(1); | ||
| 253 | lua_pushstring(lua_type(o)); | ||
| 254 | lua_pushnumber(lua_tag(o)); | ||
| 255 | } | ||
| 256 | |||
| 250 | /* }====================================================== */ | 257 | /* }====================================================== */ |
| 251 | 258 | ||
| 252 | 259 | ||
| @@ -371,13 +378,6 @@ static void luaB_tostring (void) { | |||
| 371 | lua_pushstring(buff); | 378 | lua_pushstring(buff); |
| 372 | } | 379 | } |
| 373 | 380 | ||
| 374 | |||
| 375 | static void luaB_type (void) { | ||
| 376 | lua_Object o = luaL_nonnullarg(1); | ||
| 377 | lua_pushstring(luaO_typename(luaA_Address(o))); | ||
| 378 | lua_pushnumber(lua_tag(o)); | ||
| 379 | } | ||
| 380 | |||
| 381 | /* }====================================================== */ | 381 | /* }====================================================== */ |
| 382 | 382 | ||
| 383 | 383 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.34 1999/08/16 20:52:00 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.35 1999/09/29 12:56:22 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: lua@tecgraf.puc-rio.br |
| @@ -58,6 +58,8 @@ lua_Object lua_lua2C (int number); | |||
| 58 | #define lua_getparam(_) lua_lua2C(_) | 58 | #define lua_getparam(_) lua_lua2C(_) |
| 59 | #define lua_getresult(_) lua_lua2C(_) | 59 | #define lua_getresult(_) lua_lua2C(_) |
| 60 | 60 | ||
| 61 | const char *lua_type (lua_Object object); | ||
| 62 | |||
| 61 | int lua_isnil (lua_Object object); | 63 | int lua_isnil (lua_Object object); |
| 62 | int lua_istable (lua_Object object); | 64 | int lua_istable (lua_Object object); |
| 63 | int lua_isuserdata (lua_Object object); | 65 | int lua_isuserdata (lua_Object object); |
| @@ -136,10 +138,8 @@ lua_Object lua_seterrormethod (void); /* In: new method */ | |||
| 136 | #ifdef LUA_COMPAT2_5 | 138 | #ifdef LUA_COMPAT2_5 |
| 137 | 139 | ||
| 138 | 140 | ||
| 139 | lua_Object lua_setfallback (char *event, lua_CFunction fallback); | ||
| 140 | 141 | ||
| 141 | #define lua_storeglobal lua_setglobal | 142 | #define lua_storeglobal lua_setglobal |
| 142 | #define lua_type lua_tag | ||
| 143 | 143 | ||
| 144 | #define lua_lockobject(o) lua_refobject(o,1) | 144 | #define lua_lockobject(o) lua_refobject(o,1) |
| 145 | #define lua_lock() lua_ref(1) | 145 | #define lua_lock() lua_ref(1) |
| @@ -152,8 +152,6 @@ lua_Object lua_setfallback (char *event, lua_CFunction fallback); | |||
| 152 | #define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_gettable()) | 152 | #define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_gettable()) |
| 153 | #define lua_getfield(o,f) (lua_pushobject(o), lua_pushstring(f), lua_gettable()) | 153 | #define lua_getfield(o,f) (lua_pushobject(o), lua_pushstring(f), lua_gettable()) |
| 154 | 154 | ||
| 155 | #define lua_copystring(o) (strdup(lua_getstring(o))) | ||
| 156 | |||
| 157 | #define lua_getsubscript lua_gettable | 155 | #define lua_getsubscript lua_gettable |
| 158 | #define lua_storesubscript lua_settable | 156 | #define lua_storesubscript lua_settable |
| 159 | 157 | ||
