aboutsummaryrefslogtreecommitdiff
path: root/src/lua.c
diff options
context:
space:
mode:
authorame <[email protected]>2025-08-01 21:27:11 -0500
committerame <[email protected]>2025-08-01 21:27:11 -0500
commitcd1c124e2def659dd2919e4387047de733afcc59 (patch)
tree07d7d81c3be94e4b7cdf3284e7a78939c3d683d4 /src/lua.c
parent6b0cda77a3e04e4fb3024b21bb648b6bf9f62568 (diff)
make user-agent editable with default header values
Diffstat (limited to 'src/lua.c')
-rw-r--r--src/lua.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lua.c b/src/lua.c
index ef3c032..e138f77 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -374,19 +374,21 @@ int env_table(lua_State* L, int provide_table){
return 1;
}
-//top table is prioritized
-void luaI_jointable(lua_State* L){
- int idx = lua_gettop(L) - 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);
lua_pushnil(L);
for(;lua_next(L, -2) != 0;){
lua_pushvalue(L, -2);
lua_pushvalue(L, -2);
- lua_settable(L, idx);
+ lua_settable(L, main);
lua_pop(L, 1);
}
- lua_pushvalue(L, idx);
+ lua_settop(L, idx);
}
//copys all variables from state A to B, including locals (stored in _locals)