From a3addae03634794b841b6c8c4dd8ff83542d8896 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 12 Mar 2014 17:57:40 -0300 Subject: lua_gettable and similars return type of gotten value --- lbaselib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lbaselib.c') diff --git a/lbaselib.c b/lbaselib.c index 55bd086f..e0e6a66c 100644 --- a/lbaselib.c +++ b/lbaselib.c @@ -1,5 +1,5 @@ /* -** $Id: lbaselib.c,v 1.283 2014/02/13 12:11:34 roberto Exp roberto $ +** $Id: lbaselib.c,v 1.284 2014/02/14 16:45:38 roberto Exp roberto $ ** Basic library ** See Copyright Notice in lua.h */ @@ -246,8 +246,7 @@ static int ipairsaux (lua_State *L) { luaL_checktype(L, 1, LUA_TTABLE); i++; /* next value */ lua_pushinteger(L, i); - lua_rawgeti(L, 1, i); - return (lua_isnil(L, -1)) ? 1 : 2; + return (lua_rawgeti(L, 1, i) == LUA_TNIL) ? 1 : 2; } -- cgit v1.2.3-55-g6feb