diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-27 15:47:32 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-27 15:47:32 -0300 |
| commit | 34b00c16e28c2bbc3e633b4007de956130905ed6 (patch) | |
| tree | fca960c3f8f1945a052a776722ccef4944b748fa /ltablib.c | |
| parent | 12110dec0eda3813b7609051aedb0cde932fbf93 (diff) | |
| download | lua-github-34b00c16e28c2bbc3e633b4007de956130905ed6.tar.gz | |
removed compatibility code with older versions
Diffstat (limited to 'ltablib.c')
| -rw-r--r-- | ltablib.c | 28 |
1 files changed, 1 insertions, 27 deletions
@@ -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; } |
