Browse Source

'ipairs' is deprecated

Roberto Ierusalimschy 15 năm trước cách đây
mục cha
commit
62840c5fad
1 tập tin đã thay đổi với 13 bổ sung1 xóa
  1. 13 1
      lbaselib.c

+ 13 - 1
lbaselib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lbaselib.c,v 1.236 2010/03/12 19:14:06 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.237 2010/03/13 03:57:46 roberto Exp roberto $
 ** Basic library
 ** See Copyright Notice in lua.h
 */
@@ -252,6 +252,8 @@ 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);
@@ -266,6 +268,16 @@ static int luaB_ipairs (lua_State *L) {
   return pairsmeta(L, "__ipairs", 1);
 }
 
+#else
+
+#define ipairsaux	luaB_ipairs
+
+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)