aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/lapi.c b/lapi.c
index 1391511f..decea1b5 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.73 2000/03/03 14:58:26 roberto Exp roberto $ 2** $Id: lapi.c,v 1.74 2000/03/10 18:37:44 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*/
@@ -306,9 +306,9 @@ void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
306 luaC_checkGC(L); 306 luaC_checkGC(L);
307} 307}
308 308
309void lua_pushusertag (lua_State *L, void *u, int tag) { 309void lua_pushusertag (lua_State *L, void *u, int tag) { /* ORDER LUA_T */
310 if (tag < 0 && tag != LUA_ANYTAG) 310 if (tag != LUA_ANYTAG && tag != TAG_USERDATA && tag < NUM_TAGS)
311 luaT_realtag(L, tag); /* error if tag is not valid */ 311 luaL_verror(L, "invalid tag for a userdata (%d)", tag);
312 tsvalue(L->top) = luaS_createudata(L, u, tag); 312 tsvalue(L->top) = luaS_createudata(L, u, tag);
313 ttype(L->top) = TAG_USERDATA; 313 ttype(L->top) = TAG_USERDATA;
314 incr_top; 314 incr_top;
@@ -329,13 +329,12 @@ void lua_pushobject (lua_State *L, lua_Object o) {
329 329
330 330
331int lua_tag (lua_State *L, lua_Object o) { 331int lua_tag (lua_State *L, lua_Object o) {
332 UNUSED(L);
333 if (o == LUA_NOOBJECT) 332 if (o == LUA_NOOBJECT)
334 return TAG_NIL; 333 return TAG_NIL;
335 else if (ttype(o) == TAG_USERDATA) /* to allow `old' tags (deprecated) */ 334 else if (ttype(o) == TAG_USERDATA) /* to allow `old' tags (deprecated) */
336 return o->value.ts->u.d.tag; 335 return o->value.ts->u.d.tag;
337 else 336 else
338 return luaT_effectivetag(o); 337 return luaT_effectivetag(L, o);
339} 338}
340 339
341 340