diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-13 16:17:15 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-13 16:17:15 +0000 |
commit | 6536352d531e9c6602c59e909c88146d089e2732 (patch) | |
tree | 56e2706a0eac588ee2cc1f93389bb915959b1f19 /lualib/lua_util.lua | |
parent | b630489b65c7a9e70ed615fa07b0450f7f7f9278 (diff) | |
download | rspamd-6536352d531e9c6602c59e909c88146d089e2732.tar.gz rspamd-6536352d531e9c6602c59e909c88146d089e2732.zip |
[Fix] Fix override_defaults function
Diffstat (limited to 'lualib/lua_util.lua')
-rw-r--r-- | lualib/lua_util.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua index 276b8e05a..8611946a1 100644 --- a/lualib/lua_util.lua +++ b/lualib/lua_util.lua @@ -520,7 +520,8 @@ local function override_defaults(def, override) end local res = {} - fun.each(function(k, v) + + for k,v in pairs(override) do if type(v) == 'table' then if def[k] and type(def[k]) == 'table' then -- Recursively override elements @@ -531,12 +532,13 @@ local function override_defaults(def, override) else res[k] = v end - end, override) - fun.each(function(k, v) + end + + for k,v in pairs(def) do if not res[k] then res[k] = v end - end, def) + end return res end |