From 0593256707ceddb1bc9cd4b25b822a7fbcfedd66 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 21 Mar 2024 11:23:21 -0300 Subject: 'luaH_get' functions return tag of the result Undoing previous commit. Returning TValue increases code size without any visible gains. Returning the tag is a little simpler than returning a special code (HOK/HNOTFOUND) and the tag is useful by itself in some cases. --- ltests.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ltests.c') diff --git a/ltests.c b/ltests.c index 59df7cad..1a34870e 100644 --- a/ltests.c +++ b/ltests.c @@ -1538,7 +1538,8 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { } else if EQ("getfield") { int t = getindex; - lua_getfield(L1, t, getstring); + int tp = lua_getfield(L1, t, getstring); + lua_assert(tp == lua_type(L1, -1)); } else if EQ("getglobal") { lua_getglobal(L1, getstring); @@ -1548,7 +1549,8 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { lua_pushnil(L1); } else if EQ("gettable") { - lua_gettable(L1, getindex); + int tp = lua_gettable(L1, getindex); + lua_assert(tp == lua_type(L1, -1)); } else if EQ("gettop") { lua_pushinteger(L1, lua_gettop(L1)); -- cgit v1.2.3-55-g6feb