aboutsummaryrefslogtreecommitdiff
path: root/lbaselib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-10-23 10:50:25 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-10-23 10:50:25 -0200
commitf5073de0a72562e1998f23052715e56a3b9fde18 (patch)
treedbd8772271f77b17f373cbd7a0b528def5420b81 /lbaselib.c
parentf6ed285cf2916765d7291af19a11292f4bb8689c (diff)
downloadlua-f5073de0a72562e1998f23052715e56a3b9fde18.tar.gz
lua-f5073de0a72562e1998f23052715e56a3b9fde18.tar.bz2
lua-f5073de0a72562e1998f23052715e56a3b9fde18.zip
'ipairs' goes until length of array instead of stopping at the first nil
Diffstat (limited to 'lbaselib.c')
-rw-r--r--lbaselib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lbaselib.c b/lbaselib.c
index aa6fe1dc..a2ebaeb1 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.218 2009/08/04 18:20:18 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.219 2009/10/05 16:44:33 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*/
@@ -255,7 +255,7 @@ static int ipairsaux (lua_State *L) {
255 i++; /* next value */ 255 i++; /* next value */
256 lua_pushinteger(L, i); 256 lua_pushinteger(L, i);
257 lua_rawgeti(L, 1, i); 257 lua_rawgeti(L, 1, i);
258 return (lua_isnil(L, -1)) ? 0 : 2; 258 return (lua_isnil(L, -1) && i > (int)lua_objlen(L, 1)) ? 0 : 2;
259} 259}
260 260
261 261