-
Notifications
You must be signed in to change notification settings - Fork 0
SFUtils_SavedVariables
(All of the Saved Variables functions work on the variables for the current server that you are logged in on.)
Note: You should only ever use one of the functions getToonSavedVars(), getAcctSavedVars(), or getAllSavedVars() because they are loading saved variables from files (that only get changed when you log out or /reloadui) and so are very slow and you don't want to waste time doing it multiple times for no good reason.
function LibSFUtils.getToonSavedVars(saveFile, saveVer, saveDefaults)
Get saved variables table toon only. In addition to calling the appropriate ZO_SavedVars function, it will call LibSFUtils.defaultMissing(). Note: This does NOT automatically add an accountWide variable to the table if it is not already there!
function LibSFUtils.getAcctSavedVars(saveFile, saveVer, saveDefaults)
Get saved variables table account-wide only. In addition to calling the appropriate ZO_SavedVars function, it will call LibSFUtils.defaultMissing().
function LibSFUtils.getAllSavedVars(saveFileName, saveVer, saveAWDefaults, saveToonDefaults)
Get saved variables tables when we deal with both toon and account-wide settings.
Toon and account-wide can have different default tables (but don't have to). If you only specify one default table it will be used for both account-wide and toon.
An "accountWide" variable will be automatically added to the toon table if it
does not already exist, because the currentSavedVars() function works off of that.
It is used to designate whether the settings for account-wide are currently in effect
or the toon settings are in effect.
function LibSFUtils.currentSavedVars(aw, toon, newAcctWideVal)
Return the currently active table of saved variables. If newAcctWideVal is not nil, then the toon.accountWide value will be set to the new value before deciding which of the tables aw or toon will be returned (based on if toon.accountWide evaluates to true or false).
function LibSFUtils.defaultMissing(svtable, defaulttable)
Recursively initialize missing values in a table from a defaults table. Existing values in the svtable will remain unchanged. This function is needed because the ZO_SavedVars functions do not recurse into a table inside the defaulttable if the table itself exists in svtable.