@@ -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+
4355local AddonLoaded , VariablesLoaded = false , false
4456function E :VARIABLES_LOADED ()
4557 VariablesLoaded = true
4658 if AddonLoaded then
59+ MergeTable (AdvancedInterfaceOptionsSaved , DefaultSettings )
4760 self :ADDON_LOADED (addonName )
4861 end
4962end
@@ -58,18 +71,6 @@ function E:ADDON_LOADED(addon_name)
5871 end
5972end
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-
7374function 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