'ipairs' is deprecated

This commit is contained in:
Roberto Ierusalimschy
2010-03-19 12:52:48 -03:00
parent 5ca7cdd709
commit 62840c5fad

View File

@@ -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 ** Basic library
** See Copyright Notice in lua.h ** 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) { static int ipairsaux (lua_State *L) {
int i = luaL_checkint(L, 2); int i = luaL_checkint(L, 2);
luaL_checktype(L, 1, LUA_TTABLE); luaL_checktype(L, 1, LUA_TTABLE);
@@ -266,6 +268,16 @@ static int luaB_ipairs (lua_State *L) {
return pairsmeta(L, "__ipairs", 1); 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) { static int load_aux (lua_State *L, int status) {
if (status == LUA_OK) if (status == LUA_OK)