aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorame <[email protected]>2025-09-03 18:24:03 -0500
committerame <[email protected]>2025-09-03 18:24:03 -0500
commit88a12e1ed5f15cc7039c9ad94cfb78f33d31bee9 (patch)
treef58a93d5a3c5983e83531221c00d157fab88aeab /src
parent1aba3757b486e28ddfb0aff67fe65e4a7a87c74f (diff)
merge fixes
Diffstat (limited to 'src')
-rw-r--r--src/lua.c12
-rw-r--r--src/lua.h2
-rw-r--r--src/net.c4
3 files changed, 9 insertions, 9 deletions
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)
diff --git a/src/lua.h b/src/lua.h
index d31ef58..1d5bea1 100644
--- a/src/lua.h
+++ b/src/lua.h
@@ -40,7 +40,7 @@ void luaI_newstream(lua_State* L, stream_read_function, stream_free_function, vo
int luaI_nothing(lua_State*);
int env_table(lua_State* L, int provide_table);
-void luaI_jointable(lua_State* L, int main, int merge);
+void luaI_jointable(lua_State* L);
//generic macro that takes other macros (see below)
#define _tset_b(L, Tidx, K, V, F)\
diff --git a/src/net.c b/src/net.c
index e829654..53a5ceb 100644
--- a/src/net.c
+++ b/src/net.c
@@ -539,7 +539,9 @@ int _request(lua_State* L, struct request_state* state){
luaI_tsets(L, header_idx, "User-Agent", "lullaby/"MAJOR_VERSION);
if(params >= 3){
- luaI_jointable(L, header_idx, 3);
+ lua_pushvalue(L, header_idx);
+ lua_pushvalue(L, 3);
+ luaI_jointable(L);
}
str* header = str_init("");