View Single Post
02/05/18, 10:35 AM   #3
zgwortz
Join Date: Jun 2015
Posts: 23
Thanks! After reading your reply, I did a bit of a deep dive into the ZOS code, and wrote a couple of Addons to test a number of things. I learned a LOT about how SavedVariables work, and am doing a few more tests -- I hope to put together a fairly detailed document soon on everything I learned. But for this specific question, the quick answer is this:

You *can* use ZO_SavedVars:New() as you described, but it only works if you already know the displayName of the account you want to view. Since, as far as I can tell, there's no way in the API to enumerate through the different accounts which have saved data on your machine (if anyone knows an API call for this, let me know...), we have to fall back to a different solution...

...which turns out to be trivial and very easy. Because once your addon is loaded, your savedVariablesTable is ALSO loaded as a global, if it exists. Thus, if your call is something like ZO_SavedVars:New("MyGreatAddon_SavedVariables", ...), you can simply check the global MyGreatAddon_SavedVariables directly -- all the accounts are keys under the top level "Default" key (or the profile if you are using as different profile...). You can access it directly or with _G["MyGreatAddon_SavedVariables"] if you want to do it that way.
  Reply With Quote