Skip to content

Commit 935e38b

Browse files
committed
Fix #93
1 parent 1437d41 commit 935e38b

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

basicOptions.lua

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,23 @@ local AlwaysCharacterSpecificCVars = {
4040
-- stopAutoAttackOnTargetChange
4141
}
4242

43+
local function MergeTable(a, b) -- Non-destructively merges table b into table a
44+
for k, v in pairs(b) do
45+
if a[k] == nil or type(a[k]) ~= type(b[k]) then
46+
a[k] = v
47+
-- print('replacing key', k, v)
48+
elseif type(v) == "table" then
49+
a[k] = MergeTable(a[k], b[k])
50+
end
51+
end
52+
return a
53+
end
54+
4355
local AddonLoaded, VariablesLoaded = false, false
4456
function E:VARIABLES_LOADED()
4557
VariablesLoaded = true
4658
if AddonLoaded then
59+
MergeTable(AdvancedInterfaceOptionsSaved, DefaultSettings)
4760
self:ADDON_LOADED(addonName)
4861
end
4962
end
@@ -58,18 +71,6 @@ function E:ADDON_LOADED(addon_name)
5871
end
5972
end
6073

61-
local function MergeTable(a, b) -- Non-destructively merges table b into table a
62-
for k, v in pairs(b) do
63-
if a[k] == nil or type(a[k]) ~= type(b[k]) then
64-
a[k] = v
65-
-- print('replacing key', k, v)
66-
elseif type(v) == "table" then
67-
a[k] = MergeTable(a[k], b[k])
68-
end
69-
end
70-
return a
71-
end
72-
7374
function E:Init() -- Runs after our saved variables are loaded and cvars have been loaded
7475
if AdvancedInterfaceOptionsSaved.DBVersion ~= DBVersion then
7576
-- Wipe out previous settings if database versions don't match

0 commit comments

Comments
 (0)