>From c48f8aacc41e748eec68502ca3cca4699787f1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Sun, 29 Mar 2020 17:57:37 +0200 Subject: [PATCH] Fix node.get_properties_table() --- source/texk/web2c/luatexdir/lua/lnodelib.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/texk/web2c/luatexdir/lua/lnodelib.c b/source/texk/web2c/luatexdir/lua/lnodelib.c index d5ab00a55..4e713aaa2 100644 --- a/source/texk/web2c/luatexdir/lua/lnodelib.c +++ b/source/texk/web2c/luatexdir/lua/lnodelib.c @@ -8406,7 +8406,7 @@ static int lua_nodelib_get_property_t(lua_State * L) if (n == null) { lua_pushnil(L); } else { - lua_rawgeti(L,1,n); + lua_rawgeti(L,lua_upvalueindex(1),n); } return 1; } @@ -8417,7 +8417,7 @@ static int lua_nodelib_set_property_t(lua_State * L) halfword n = *((halfword *) lua_touserdata(L, 2)); if (n != null) { lua_settop(L,3); - lua_rawseti(L,1,n); + lua_rawseti(L,lua_upvalueindex(1),n); } return 0; } @@ -8831,16 +8831,19 @@ static const struct luaL_Reg nodelib_p[] = { static void lua_new_properties_table(lua_State * L) { - lua_pushstring(L,"node.properties"); lua_newtable(L); + lua_pushstring(L,"node.properties"); + lua_pushvalue(L,-2); lua_settable(L,LUA_REGISTRYINDEX); lua_pushstring(L,"node.properties.indirect"); lua_newtable(L); luaL_newmetatable(L,"node.properties.indirect.meta"); - luaL_openlib(L, NULL, nodelib_p, 0); + lua_pushvalue(L,-4); + luaL_openlib(L, NULL, nodelib_p, 1); lua_setmetatable(L,-2); lua_settable(L,LUA_REGISTRYINDEX); + lua_pop(L,1); } /* node.direct.* */ -- 2.26.0