From ade585bdf9e286a0ec01796763ded6701c6b1a8f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 28 Mar 2005 14:17:53 -0300 Subject: no more LUA_FIRSTINDEX --- lbaselib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lbaselib.c') diff --git a/lbaselib.c b/lbaselib.c index ea50cd9c..358ca427 100644 --- a/lbaselib.c +++ b/lbaselib.c @@ -1,5 +1,5 @@ /* -** $Id: lbaselib.c,v 1.171 2005/03/16 16:58:41 roberto Exp roberto $ +** $Id: lbaselib.c,v 1.172 2005/03/22 16:04:29 roberto Exp roberto $ ** Basic library ** See Copyright Notice in lua.h */ @@ -240,7 +240,7 @@ static int luaB_ipairs (lua_State *L) { luaL_checktype(L, 1, LUA_TTABLE); lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ lua_pushvalue(L, 1); /* state, */ - lua_pushinteger(L, LUA_FIRSTINDEX - 1); /* and initial value */ + lua_pushinteger(L, 0); /* and initial value */ return 3; } @@ -340,12 +340,12 @@ static int luaB_getn (lua_State *L) { static int luaB_unpack (lua_State *L) { - int i = luaL_optint(L, 2, LUA_FIRSTINDEX); + int i = luaL_optint(L, 2, 1); int e = luaL_optint(L, 3, -1); int n; luaL_checktype(L, 1, LUA_TTABLE); if (e == -1) - e = luaL_getn(L, 1) + LUA_FIRSTINDEX - 1; + e = luaL_getn(L, 1); n = e - i + 1; /* number of elements */ if (n <= 0) return 0; /* empty range */ luaL_checkstack(L, n, "table too big to unpack"); -- cgit v1.2.3-55-g6feb