aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-06-13 16:41:34 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-06-13 16:41:34 -0300
commitb98de30b8f52986fae7ad84d4622d16fef6872b8 (patch)
treea712cb81b2d501683b1d6cf8a0dbf8f09068b8b0
parent9f48712c15aba8fd48f9d2e93195ed84e69f8f90 (diff)
downloadlua-b98de30b8f52986fae7ad84d4622d16fef6872b8.tar.gz
lua-b98de30b8f52986fae7ad84d4622d16fef6872b8.tar.bz2
lua-b98de30b8f52986fae7ad84d4622d16fef6872b8.zip
'ipair' is back
-rw-r--r--lbaselib.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/lbaselib.c b/lbaselib.c
index d28708af..a84e682d 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -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
215static int ipairsaux (lua_State *L) { 213static 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
231static int luaB_ipairs (lua_State *L) {
232 return luaL_error(L, "'ipairs' deprecated");
233}
234
235#endif
236
237 227
238static int load_aux (lua_State *L, int status) { 228static int load_aux (lua_State *L, int status) {
239 if (status == LUA_OK) 229 if (status == LUA_OK)