Hi alltogether,
as far as I understood we need a registered/whitelisted variable name and an addon it belongs to, right?
Why not using a build-in variable? I would suggest to write a generic framework (Maybe as part of LibStub?)
This is working Proof of Concept code:
Lua Code:
local varDefaults = { Test = "1234" }
local asv
SLASH_COMMANDS["/test1"] = function() asv.Test = GetTimeStamp() end
SLASH_COMMANDS["/test2"] = function() d(asv.Test) end
local function OnAddOnLoaded(event, addonName)
if addonName == "ZO_Ingame" then
EVENT_MANAGER:UnregisterForEvent("CommonAddonLibrary", EVENT_ADD_ON_LOADED)
asv = ZO_SavedVars:NewAccountWide("ZO_Ingame_SavedVariables", 1, "CommonAddonLibrary", varDefaults)
end
end
EVENT_MANAGER:RegisterForEvent("CommonAddonLibrary", EVENT_ADD_ON_LOADED, OnAddOnLoaded)
Edit: The root section (here CommonAddonLibrary) should have a very unique name, handled by the framework only. Addon authors using the framework can register sub-sections, only. To avoid conflict with names used by ZO.