Originally Posted by coolmodi
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.
|
the prototype is
ZO_DeepTableCopy(source, dest); I have SimpleXPBar.CharSV get overwritten if accountwide is chosen so that the individual characters will have there settings overwritten, this was intended to mitigate the issue of [when you uncheck the accountwide setting you have to redo all the changes you made on each character], though I may just add a button to push current settings to all characters for this purpose.
Originally Posted by coolmodi
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, },
|
I'll try it like yours, without the deepcopy, I'm still not entirely sure how shallow copying works in Lua yet; I like that trick with using unpack, I wasn't aware of that function. Thanks.