Originally Posted by Randactyl
I've seen this mentioned a couple of times. How does one avoid ZO_SavedVars in the first place?
|
You can directly access saved variables table defined in manifest (.txt):
Code:
## SavedVariables: MyAddon_SavedVariables
Lua Code:
local savedVars
local defaults = {
key1 = "value1",
key2 = "value2",
}
EVENT_MANAGER:RegisterForEvent("MyAddon", EVENT_ADD_ON_LOADED,
function(event, addon)
if addon ~= "MyAddon" then return end
EVENT_MANAGER:UnregisterForEvent("MyAddon", event)
MyAddon_SavedVariables = MyAddon_SavedVariables or defaults
savedVars = MyAddon_SavedVariables
end)
As an example check Wykkyd's or Seerah's addons.