Skip to content

Commit

Permalink
Fix #93
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanzilla committed Jul 28, 2024
1 parent 1437d41 commit 935e38b
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions basicOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,23 @@ local AlwaysCharacterSpecificCVars = {
-- stopAutoAttackOnTargetChange
}

local function MergeTable(a, b) -- Non-destructively merges table b into table a
for k, v in pairs(b) do
if a[k] == nil or type(a[k]) ~= type(b[k]) then
a[k] = v
-- print('replacing key', k, v)
elseif type(v) == "table" then
a[k] = MergeTable(a[k], b[k])
end
end
return a
end

local AddonLoaded, VariablesLoaded = false, false
function E:VARIABLES_LOADED()
VariablesLoaded = true
if AddonLoaded then
MergeTable(AdvancedInterfaceOptionsSaved, DefaultSettings)
self:ADDON_LOADED(addonName)
end
end
Expand All @@ -58,18 +71,6 @@ function E:ADDON_LOADED(addon_name)
end
end

local function MergeTable(a, b) -- Non-destructively merges table b into table a
for k, v in pairs(b) do
if a[k] == nil or type(a[k]) ~= type(b[k]) then
a[k] = v
-- print('replacing key', k, v)
elseif type(v) == "table" then
a[k] = MergeTable(a[k], b[k])
end
end
return a
end

function E:Init() -- Runs after our saved variables are loaded and cvars have been loaded
if AdvancedInterfaceOptionsSaved.DBVersion ~= DBVersion then
-- Wipe out previous settings if database versions don't match
Expand Down

0 comments on commit 935e38b

Please sign in to comment.