diff options
| -rw-r--r-- | lbaselib.c | 14 |
1 files changed, 2 insertions, 12 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbaselib.c,v 1.243 2010/04/19 17:02:02 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.244 2010/06/10 21:29:47 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 | */ |
| @@ -210,15 +210,13 @@ static int luaB_pairs (lua_State *L) { | |||
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | 212 | ||
| 213 | #if defined(LUA_COMPAT_IPAIRS) | ||
| 214 | |||
| 215 | static int ipairsaux (lua_State *L) { | 213 | static int ipairsaux (lua_State *L) { |
| 216 | int i = luaL_checkint(L, 2); | 214 | int i = luaL_checkint(L, 2); |
| 217 | luaL_checktype(L, 1, LUA_TTABLE); | 215 | luaL_checktype(L, 1, LUA_TTABLE); |
| 218 | i++; /* next value */ | 216 | i++; /* next value */ |
| 219 | lua_pushinteger(L, i); | 217 | lua_pushinteger(L, i); |
| 220 | lua_rawgeti(L, 1, i); | 218 | lua_rawgeti(L, 1, i); |
| 221 | return (lua_isnil(L, -1) && i > luaL_len(L, 1)) ? 0 : 2; | 219 | return (lua_isnil(L, -1)) ? 1 : 2; |
| 222 | } | 220 | } |
| 223 | 221 | ||
| 224 | 222 | ||
| @@ -226,14 +224,6 @@ static int luaB_ipairs (lua_State *L) { | |||
| 226 | return pairsmeta(L, "__ipairs", 1, ipairsaux); | 224 | return pairsmeta(L, "__ipairs", 1, ipairsaux); |
| 227 | } | 225 | } |
| 228 | 226 | ||
| 229 | #else | ||
| 230 | |||
| 231 | static int luaB_ipairs (lua_State *L) { | ||
| 232 | return luaL_error(L, "'ipairs' deprecated"); | ||
| 233 | } | ||
| 234 | |||
| 235 | #endif | ||
| 236 | |||
| 237 | 227 | ||
| 238 | static int load_aux (lua_State *L, int status) { | 228 | static int load_aux (lua_State *L, int status) { |
| 239 | if (status == LUA_OK) | 229 | if (status == LUA_OK) |
