diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-20 16:14:54 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-20 16:14:54 -0300 |
commit | bb9605bbc954d53b7d5997c53fceafe4450a6917 (patch) | |
tree | f62d6f64623221e2ba807aa080b84f2572640975 /lapi.c | |
parent | 67592998809bf5816e2256409b384a712270c7b2 (diff) | |
download | lua-bb9605bbc954d53b7d5997c53fceafe4450a6917.tar.gz lua-bb9605bbc954d53b7d5997c53fceafe4450a6917.tar.bz2 lua-bb9605bbc954d53b7d5997c53fceafe4450a6917.zip |
tags can be positive values
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -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 | ||
309 | void lua_pushusertag (lua_State *L, void *u, int tag) { | 309 | void 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 | ||
331 | int lua_tag (lua_State *L, lua_Object o) { | 331 | int 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 | ||