From 34b00c16e28c2bbc3e633b4007de956130905ed6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 27 Feb 2018 15:47:32 -0300 Subject: removed compatibility code with older versions --- ltablib.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'ltablib.c') diff --git a/ltablib.c b/ltablib.c index 982821ed..22bfae42 100644 --- a/ltablib.c +++ b/ltablib.c @@ -1,5 +1,5 @@ /* -** $Id: ltablib.c,v 1.93 2016/02/25 19:41:54 roberto Exp roberto $ +** $Id: ltablib.c,v 1.94 2018/02/25 12:48:16 roberto Exp roberto $ ** Library for Table Manipulation ** See Copyright Notice in lua.h */ @@ -58,24 +58,6 @@ static void checktab (lua_State *L, int arg, int what) { } -#if defined(LUA_COMPAT_MAXN) -static int maxn (lua_State *L) { - lua_Number max = 0; - luaL_checktype(L, 1, LUA_TTABLE); - lua_pushnil(L); /* first key */ - while (lua_next(L, 1)) { - lua_pop(L, 1); /* remove value */ - if (lua_type(L, -1) == LUA_TNUMBER) { - lua_Number v = lua_tonumber(L, -1); - if (v > max) max = v; - } - } - lua_pushnumber(L, max); - return 1; -} -#endif - - static int tinsert (lua_State *L) { lua_Integer e = aux_getn(L, 1, TAB_RW) + 1; /* first empty element */ lua_Integer pos; /* where to insert new element */ @@ -425,9 +407,6 @@ static int sort (lua_State *L) { static const luaL_Reg tab_funcs[] = { {"concat", tconcat}, -#if defined(LUA_COMPAT_MAXN) - {"maxn", maxn}, -#endif {"insert", tinsert}, {"pack", pack}, {"unpack", unpack}, @@ -440,11 +419,6 @@ static const luaL_Reg tab_funcs[] = { LUAMOD_API int luaopen_table (lua_State *L) { luaL_newlib(L, tab_funcs); -#if defined(LUA_COMPAT_UNPACK) - /* _G.unpack = table.unpack */ - lua_getfield(L, -1, "unpack"); - lua_setglobal(L, "unpack"); -#endif return 1; } -- cgit v1.2.3-55-g6feb