What I see at the first glance is this
Lua Code:
if SimpleXPBar.accountwide_settings.isAccountWide then
ZO_DeepTableCopy(SimpleXPBar.AWSV, SimpleXPBar.CharSV)
SimpleXPBar.CurSV = SimpleXPBar.AWSV
else
SimpleXPBar.CurSV = SimpleXPBar.CharSV
end
Doesn't that mean you use AWSV to save new changes but copy the data from CharSV (that didn't change) over that every time you reload UI? That would reset it to whatever is in CharSV. But maybe ZO_DeepTableCopy is the other way round, don't know.
Edit: Either way I think it has to be the ZO_DeepTableCopy function, my solution was pretty much the same, just without copying tables around (why would you do that anyways?).
Lua Code:
function GroupDamage:RestoreData()
self.savedVariablesAw = ZO_SavedVars:NewAccountWide("GroupDamageSavedVariables", defaultVarsVer, nil, defaults)
self.savedVariablesChar = ZO_SavedVars:New("GroupDamageSavedVariables", defaultVarsVer, nil, defaults)
self.svars = self.savedVariablesChar
if self.savedVariablesAw.accountWide then
self.svars = self.savedVariablesAw
end
end
--the AW checkbox
{
type = "checkbox",
name = GetString(SI_GROUPDAMAGE_MENU_ACCWIDESETTINGS),
getFunc = function() return self.savedVariablesAw.accountWide end,
setFunc = function() self.savedVariablesAw.accountWide = not self.savedVariablesAw.accountWide ReloadUI() end,
warning = GetString(SI_GROUPDAMAGE_MENU_RELOADWARN)
},
--a colorpicker, you can use tables for the colors and then unpack(table) to make it alot shorter and easier to use ;)
{
type = "colorpicker",
name = GetString(SI_GROUPDAMAGE_MENU_BARSCOLOR),
getFunc = function() return unpack(self.svars.panelBarsColor) end,
setFunc = function(r,g,b,a)
self.svars.panelBarsColor = {r,g,b,a}
self:ResetPanelControls()
end,
},