aboutsummaryrefslogtreecommitdiff
path: root/lbaselib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lbaselib.c')
-rw-r--r--lbaselib.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lbaselib.c b/lbaselib.c
index ea50cd9c..358ca427 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.171 2005/03/16 16:58:41 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.172 2005/03/22 16:04:29 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -240,7 +240,7 @@ static int luaB_ipairs (lua_State *L) {
240 luaL_checktype(L, 1, LUA_TTABLE); 240 luaL_checktype(L, 1, LUA_TTABLE);
241 lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ 241 lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */
242 lua_pushvalue(L, 1); /* state, */ 242 lua_pushvalue(L, 1); /* state, */
243 lua_pushinteger(L, LUA_FIRSTINDEX - 1); /* and initial value */ 243 lua_pushinteger(L, 0); /* and initial value */
244 return 3; 244 return 3;
245} 245}
246 246
@@ -340,12 +340,12 @@ static int luaB_getn (lua_State *L) {
340 340
341 341
342static int luaB_unpack (lua_State *L) { 342static int luaB_unpack (lua_State *L) {
343 int i = luaL_optint(L, 2, LUA_FIRSTINDEX); 343 int i = luaL_optint(L, 2, 1);
344 int e = luaL_optint(L, 3, -1); 344 int e = luaL_optint(L, 3, -1);
345 int n; 345 int n;
346 luaL_checktype(L, 1, LUA_TTABLE); 346 luaL_checktype(L, 1, LUA_TTABLE);
347 if (e == -1) 347 if (e == -1)
348 e = luaL_getn(L, 1) + LUA_FIRSTINDEX - 1; 348 e = luaL_getn(L, 1);
349 n = e - i + 1; /* number of elements */ 349 n = e - i + 1; /* number of elements */
350 if (n <= 0) return 0; /* empty range */ 350 if (n <= 0) return 0; /* empty range */
351 luaL_checkstack(L, n, "table too big to unpack"); 351 luaL_checkstack(L, n, "table too big to unpack");