From f67ccfbdeb9595b0549a733d229a02a7c3205ddc Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 26 Jun 2002 16:28:44 -0300 Subject: no more `lua_getn' function --- lapi.c | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) (limited to 'lapi.c') diff --git a/lapi.c b/lapi.c index 84b3fe72..67fe9ddc 100644 --- a/lapi.c +++ b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 1.202 2002/06/24 13:08:45 roberto Exp roberto $ +** $Id: lapi.c,v 1.203 2002/06/25 19:15:41 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -697,43 +697,6 @@ LUA_API int lua_next (lua_State *L, int index) { } -LUA_API int lua_getn (lua_State *L, int index) { - StkId t; - const TObject *value; - int n; - lua_lock(L); - t = luaA_index(L, index); - api_check(L, ttype(t) == LUA_TTABLE); - value = luaH_getstr(hvalue(t), luaS_newliteral(L, "n")); /* = t.n */ - if (ttype(value) == LUA_TNUMBER) - lua_number2int(n, nvalue(value)); - else { - Node *nd; - Table *a = hvalue(t); - lua_Number max = 0; - int i; - i = sizearray(a); - while (i--) { - if (ttype(&a->array[i]) != LUA_TNIL) - break; - } - max = i+1; - i = sizenode(a); - nd = a->node; - while (i--) { - if (ttype(key(nd)) == LUA_TNUMBER && - ttype(val(nd)) != LUA_TNIL && - nvalue(key(nd)) > max) - max = nvalue(key(nd)); - nd++; - } - lua_number2int(n, max); - } - lua_unlock(L); - return n; -} - - LUA_API void lua_concat (lua_State *L, int n) { lua_lock(L); api_checknelems(L, n); -- cgit v1.2.3-55-g6feb