Browse Source

lua_settag does not pop its argument

Roberto Ierusalimschy 25 years ago
parent
commit
aadc35449e
2 changed files with 3 additions and 5 deletions
  1. 1 2
      lapi.c
  2. 2 3
      lbaselib.c

+ 1 - 2
lapi.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lapi.c,v 1.106 2000/10/06 19:29:26 roberto Exp roberto $
+** $Id: lapi.c,v 1.107 2000/10/20 16:39:03 roberto Exp roberto $
 ** Lua API
 ** See Copyright Notice in lua.h
 */
@@ -433,7 +433,6 @@ LUA_API void lua_settag (lua_State *L, int tag) {
       luaO_verror(L, "cannot change the tag of a %.20s",
                   luaO_typename(L->top-1));
   }
-  L->top--;
 }
 
 

+ 2 - 3
lbaselib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lbaselib.c,v 1.12 2000/10/20 16:39:03 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.13 2000/10/20 16:57:42 roberto Exp roberto $
 ** Basic library
 ** See Copyright Notice in lua.h
 */
@@ -138,8 +138,7 @@ static int luaB_settag (lua_State *L) {
   luaL_checktype(L, 1, LUA_TTABLE);
   lua_pushvalue(L, 1);  /* push table */
   lua_settag(L, luaL_check_int(L, 2));
-  lua_pop(L, 1);  /* remove second argument */
-  return 1;  /* return first argument */
+  return 1;  /* return table */
 }
 
 static int luaB_newtag (lua_State *L) {