View Single Post
07/26/18, 08:50 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,976
Maybe I got you wrong but you tried to use namespace as an "optional argument". So why don't you just put nil in the correct place as you call the function?
Lua Code:
  1. ZO_SavedVars:New("TestSV",1, nil, {},"TestProfile")

Edit:
Oh sorry just saw the lines 142ff in the sourcecode and now I understood what you are up to


Lua Code:
  1. --namespace is an optional argument
  2.     if defaults == nil and type(namespace) == "table" then
  3.         profile = defaults
  4.         defaults = namespace        
  5.         namespace = nil
  6.     end
  7.     profile = profile or "Default"
  8.     if type(profile) ~= "string" then
  9.         error("Profile must be a string or nil")
  10.     end




Here are the prameters of the function GetNewSavedVars from the live server:
Lua Code:
  1. local function GetNewSavedVars(savedVariableTable, version, namespace, defaults, profile, displayName, characterName, characterId, characterKeyType)

Parameters of ZO_SavedVars:New()
Lua Code:
  1. function ZO_SavedVars:New(savedVariableTable, version, namespace, defaults, profile, displayName, characterName, characterId, characterKeyType)


If you use ZO_SavedVars:New from your example:
Lua Code:
  1. ZO_SavedVars:New("TestSV",1,{},"TestProfile")

savedVariableTable: "TestSV"
version: 1
namespace: {}
defaults: "TestProfile"
profile: nil

Last edited by Baertram : 07/26/18 at 08:53 AM.