From 88a12e1ed5f15cc7039c9ad94cfb78f33d31bee9 Mon Sep 17 00:00:00 2001 From: ame Date: Wed, 3 Sep 2025 18:24:03 -0500 Subject: merge fixes --- src/lua.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/lua.c') diff --git a/src/lua.c b/src/lua.c index eedda0e..2623e29 100644 --- a/src/lua.c +++ b/src/lua.c @@ -375,21 +375,19 @@ int env_table(lua_State* L, int provide_table){ return 1; } -//main is the default values, merge is the new and overridden ones -void luaI_jointable(lua_State* L, int main, int merge){ - int idx = lua_gettop(L); - - lua_pushvalue(L, merge); +//top table is prioritized +void luaI_jointable(lua_State* L){ + int idx = lua_gettop(L) - 1; lua_pushnil(L); for(;lua_next(L, -2) != 0;){ lua_pushvalue(L, -2); lua_pushvalue(L, -2); - lua_settable(L, main); + lua_settable(L, idx); lua_pop(L, 1); } - lua_settop(L, idx); + lua_pushvalue(L, idx); } //copys all variables from state A to B, including locals (stored in _locals) -- cgit v1.2.3