Hello.
I'm trying to use profiles in one of my addons and everything works fine until I change the profile, where I lose every default value.
Let's say I have the next code:
Code:
local PROFILE_DEFAULTS = {
profile = {
defaultValue = true,
anotherValue = "default"
}
}
function MyAddon:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("MyAddonDB", PROFILE_DEFAULTS)
private.db = self.db
end
Now I change some settings where I change the value of "anotherValue" to "changed".
When I logout, I can see in my savedVariables.lua the next table:
Code:
["profileKeys"] = {
["myCharacter"] = "profile1",
},
["profiles"] = {
["profile1"] = {
["anotherValue"] = "changed"
}
},
If I try to set this profile to a second character, I get the next values:
Code:
private.db:SetProfile("profile1")
print(private.db.profile.anotherValue) --prints changed
print(private.db.profile.defaultValue) --prints nil
Somehow after changing the profile my default values are lost.
If I reset the UI then everything works again, and I have both values.
I tried using AceDBOptions, and I get the same result.
Am I doing something wrong in here?
Thanks.