From 6384475ec4112361b0ab27de553e85863464b846 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 22 Sep 2014 03:42:15 -0300 Subject: 'luaL_getmetafield' returns type of metafield (instead of a boolean) --- ltablib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ltablib.c') diff --git a/ltablib.c b/ltablib.c index fd868915..8fced7a3 100644 --- a/ltablib.c +++ b/ltablib.c @@ -1,5 +1,5 @@ /* -** $Id: ltablib.c,v 1.74 2014/08/21 19:13:55 roberto Exp roberto $ +** $Id: ltablib.c,v 1.75 2014/08/21 20:07:56 roberto Exp roberto $ ** Library for Table Manipulation ** See Copyright Notice in lua.h */ @@ -126,10 +126,10 @@ static int tmove (lua_State *L) { luaL_argcheck(L, f > 0, 2, "initial position must be positive"); if (e >= f) { /* otherwise, nothing to move */ lua_Integer n, i; - ta.geti = (!luaL_getmetafield(L, 1, "__index")) + ta.geti = (luaL_getmetafield(L, 1, "__index") == LUA_TNIL) ? (luaL_checktype(L, 1, LUA_TTABLE), lua_rawgeti) : lua_geti; - ta.seti = (!luaL_getmetafield(L, tt, "__newindex")) + ta.seti = (luaL_getmetafield(L, tt, "__newindex") == LUA_TNIL) ? (luaL_checktype(L, tt, LUA_TTABLE), lua_rawseti) : lua_seti; n = e - f + 1; /* number of elements to move */ -- cgit v1.2.3-55-g6feb