Thread Tools Display Modes
08/24/14, 12:24 AM   #1
Savitar
Join Date: Aug 2014
Posts: 2
ZO_SavedVars question

Is there any way for an addon to always load it's data from a SavedVar all the time rather than just the one time on load?
Or is there a way to wipe a saved structure in memory so that on a /reloadui the data in a SavedVar isn't saved over with the in memory data but refreshed from the SavedVar data?

Thnx for any help in advance.
  Reply With Quote
08/24/14, 02:59 AM   #2
Sasky
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 231
That's handled by the game code, not addon code, so we can't do anything about it. I'm pretty sure several people looked at using this a means to avoid the no-url limitation (have external program r/w from SavedVars file and addon could load in changes).
  Reply With Quote
08/24/14, 06:00 AM   #3
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by Savitar View Post
Or is there a way to wipe a saved structure in memory so that on a /reloadui the data in a SavedVar isn't saved over with the in memory data but refreshed from the SavedVar data?
You can simply delete the saved variables table and it won't be saved.
Lua Code:
  1. -- given that in manifest you have ## SavedVariables: mySavedVars
  2. -- delete the table (not the file) so it won't rewrite the file on /reloadui
  3. _G["mySavedVars"] = nil

Or if you want to be able to go back to the saved state without reload, you can backup the state on load and restore later:
Lua Code:
  1. -- save a copy of saved vars after load
  2. backupSavedVars = ZO_DeepTableCopy(mySavedVars)
  3.  
  4. -- then you can restore the saved state
  5. ZO_ClearTable(mySavedVars)
  6. ZO_DeepTableCopy(backupSavedVars, mySavedVars)
  Reply With Quote
08/24/14, 08:43 AM   #4
Savitar
Join Date: Aug 2014
Posts: 2
Thanks for the pointers Sasky and merlight. The whole one time read problem kills alot of projects dead in the water. Very good to know the memory table trick.
I guess what I wanted to do isn't possible.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » ZO_SavedVars question


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off