commit b98de30b8f52986fae7ad84d4622d16fef6872b8
parent 9f48712c15aba8fd48f9d2e93195ed84e69f8f90
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Sun, 13 Jun 2010 16:41:10 -0300
'ipair' is back
Diffstat:
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/lbaselib.c b/lbaselib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lbaselib.c,v 1.243 2010/04/19 17:02:02 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.244 2010/06/10 21:29:47 roberto Exp roberto $
** Basic library
** See Copyright Notice in lua.h
*/
@@ -210,15 +210,13 @@ static int luaB_pairs (lua_State *L) {
}
-#if defined(LUA_COMPAT_IPAIRS)
-
static int ipairsaux (lua_State *L) {
int i = luaL_checkint(L, 2);
luaL_checktype(L, 1, LUA_TTABLE);
i++; /* next value */
lua_pushinteger(L, i);
lua_rawgeti(L, 1, i);
- return (lua_isnil(L, -1) && i > luaL_len(L, 1)) ? 0 : 2;
+ return (lua_isnil(L, -1)) ? 1 : 2;
}
@@ -226,14 +224,6 @@ static int luaB_ipairs (lua_State *L) {
return pairsmeta(L, "__ipairs", 1, ipairsaux);
}
-#else
-
-static int luaB_ipairs (lua_State *L) {
- return luaL_error(L, "'ipairs' deprecated");
-}
-
-#endif
-
static int load_aux (lua_State *L, int status) {
if (status == LUA_OK)