View Single Post
03/07/21, 10:31 PM   #7
Shadowfen
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 84
I use a function from my LibSFUtils library, called LibSFUtils.defaultMissing(). You pass in the saved variable table and the defaults table and it recurses down the defaults table looking for values that are not in the saved variable table. When a variable:value is found to be missing, it is put into the saved variable table. If there is a variable already in the saved variable table, then its value is left untouched.

My typical usage is:
Code:
    local save = ZO_SavedVars:NewAccountWide(savedvar, sv_version, nil, defaults)
    LibSFUtils.defaultMissing(savedvar, defaults)  -- adds in new variables in old savevars
  Reply With Quote