Hi Votan,
That's a good point about delaying unregistering the addon loaded event. I hadn't thought of that.
I am wondering if you could maybe provide an example of direct alteration of a saved variable for an addon using the method you describe. Assume the following scenario.
Someone else has an addon that defines SavedVariables in a local scope like this:
Code:
local SomeAddon = {}
SomeAddon.Name = "Some Addon"
local SavedVariables
local Defults = {}
local function OnAddonLoaded(event, addonName)
if addonName ~= SomeAddon.Name then return end
EVENT_MANAGER:UnregisterForEvent(CWMAddon.Name, EVENT_ADD_ON_LOADED)
SavedVariables = ZO_SavedVars:New(SomeAddon.Name, 1, nil, Defaults)
end
EVENT_MANAGER:RegisterForEvent("SomeAddon", EVENT_ADD_ON_LOADED, OnAddonLoad)
Or alternately like this, but either way local scope:
Code:
SomeAddon.SavedVariables = ZO_SavedVars:New(SomeAddon.Name, 1, nil, Defaults)
Assuming both "SomeAddon" and my addon are loaded, how can I directly change SomeAddon's saved variables when defined as such in local scope?
EDIT:
Using Zgoo or /script d(SomeAddon), the later being the manifest name for saved variables, I can see the table structure.
Code:
["Default"] = table [#0,1]
["@AccountName"] = table [#0,10]
["$AccountWide"] = table [#0,9]
["Character1"] = table [#0,9]
["Character2"] = table [#0,9]
["Character3"] = table [#0,9]
...etc.
How to reference the variables in each of the "Character" and "@AccountName" tables?