aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-09 17:53:16 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-09 17:53:16 -0200
commit6875fdc8be9029b1bb29379c59d5409a0df42c10 (patch)
treeaf7d5845b1e209473ecf8ad0f53a188974628b20 /lapi.c
parentdc17a9cc24a52a298dbfb7ffe8aaad393f7c1bf9 (diff)
downloadlua-6875fdc8be9029b1bb29379c59d5409a0df42c10.tar.gz
lua-6875fdc8be9029b1bb29379c59d5409a0df42c10.tar.bz2
lua-6875fdc8be9029b1bb29379c59d5409a0df42c10.zip
new semantics for pushuserdata (no more different userdatas with same value)
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 e58fe789..c0c9f234 100644
--- a/lapi.c
+++ b/lapi.c
@@ -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
338LUA_API void lua_pushusertag (lua_State *L, void *u, int tag) { 338LUA_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