From e85515958b0910e932cd50d5366c7406401d5236 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 21 Jun 2007 10:48:04 -0300 Subject: [PATCH] clearing some old compatibility code --- ltablib.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/ltablib.c b/ltablib.c index c2323eb2..d47fdde6 100644 --- a/ltablib.c +++ b/ltablib.c @@ -1,5 +1,5 @@ /* -** $Id: ltablib.c,v 1.37 2005/10/21 13:47:42 roberto Exp roberto $ +** $Id: ltablib.c,v 1.38 2005/10/23 17:38:15 roberto Exp roberto $ ** Library for Table Manipulation ** See Copyright Notice in lua.h */ @@ -16,7 +16,7 @@ #include "lualib.h" -#define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n)) +#define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), lua_objlen(L, n)) static int foreachi (lua_State *L) { @@ -76,14 +76,7 @@ static int getn (lua_State *L) { static int setn (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); -#ifndef luaL_setn - luaL_setn(L, 1, luaL_checkint(L, 2)); -#else - luaL_error(L, LUA_QL("setn") " is obsolete"); -#endif - lua_pushvalue(L, 1); - return 1; + return luaL_error(L, LUA_QL("setn") " is obsolete"); } @@ -109,7 +102,6 @@ static int tinsert (lua_State *L) { return luaL_error(L, "wrong number of arguments to " LUA_QL("insert")); } } - luaL_setn(L, 1, e); /* new size */ lua_rawseti(L, 1, pos); /* t[pos] = v */ return 0; } @@ -119,7 +111,6 @@ static int tremove (lua_State *L) { int e = aux_getn(L, 1); int pos = luaL_optint(L, 2, e); if (e == 0) return 0; /* table is `empty' */ - luaL_setn(L, 1, e - 1); /* t.n = n-1 */ lua_rawgeti(L, 1, pos); /* result = t[pos] */ for ( ;pos