View Single Post
12/19/14, 02:26 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Edit: I just looked a bit closer to your code:
Maybe you are calling ZO_SavedVars:NewAccountWide a bit too early. What if the addon is not "ZO_Ingame"? You do not exit. Instead you unregister as soon as the first event is called.

If it still wont work, I think this will work using the library as a stand-alone addon having its own manifest file, only.
Because you have to register the variable to be saved and reloaded. And this seems to be a "security feature".
As soon as using the "embedded style", it is "just" some code.

One way, which may works is to use a global variable, which is referenced by the save-variable of all addons. While loading it must be part of the library to copy the data from any addon to that global variable. (Using a timestamp to get the most recent data). Really a copy, not changing the reference to another variable.
Redundant on disk, I know.

Something like:
Lua Code:
  1. addon_savevar.trackData = ln4r:GetSavedVariable(addon_savevar.trackData)
addon_savevar.trackData can be nil the first time.
addon_savevar.trackData contains a timestamp managed by the library.
ln4r:GetSavedVariable takes over the data or not, depending on the timestamp, and always returns the shared variable (=lua table).

Last edited by votan : 12/19/14 at 04:22 AM.
  Reply With Quote