diff options
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.125 2001/02/02 15:13:05 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.126 2001/02/07 18:13:49 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 | */ |
| @@ -335,14 +335,13 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { | |||
| 335 | } | 335 | } |
| 336 | 336 | ||
| 337 | 337 | ||
| 338 | LUA_API void lua_pushusertag (lua_State *L, void *u, int tag) { | 338 | LUA_API int lua_pushuserdata (lua_State *L, void *u) { |
| 339 | int isnew; | ||
| 339 | LUA_LOCK(L); | 340 | LUA_LOCK(L); |
| 340 | /* ORDER LUA_T */ | 341 | isnew = luaS_createudata(L, u, L->top); |
| 341 | if (!(tag == LUA_ANYTAG || tag == LUA_TUSERDATA || validtag(G(L), tag))) | ||
| 342 | luaO_verror(L, "invalid tag for a userdata (%d)", tag); | ||
| 343 | setuvalue(L->top, luaS_createudata(L, u, tag)); | ||
| 344 | api_incr_top(L); | 342 | api_incr_top(L); |
| 345 | LUA_UNLOCK(L); | 343 | LUA_UNLOCK(L); |
| 344 | return isnew; | ||
| 346 | } | 345 | } |
| 347 | 346 | ||
| 348 | 347 | ||
