There is no need to use NotifyChange unless you alter the settings via an external method like a LDB display or minimap button.
Other issues:
- You don't specify the profile subtable within the defaults table.
- There is no need to load all the Ace3 modules globally across your addon. AceDB and AceConfig can be local to OnInitialize.
- Lua does not require ending lines of code with a semicolon. Lua totally ignores ; at the end of a line.
Code:
local MyAddOn = LibStub("AceAddon-3.0"):NewAddon("MyAddOn")
local db
local defaults = {
profile = {
cats = true,
}
}
function MyAddOn:Initialize()
self.db = LibStub("AceDB-3.0"):New("MyAddOnDB", defaults, true)
self.db.RegisterCallback(self, "OnProfileChanged", "RefreshConfig")
self.db.RegisterCallback(self, "OnProfileCopied", "RefreshConfig")
self.db.RegisterCallback(self, "OnProfileReset", "RefreshConfig")
db = self.db
end
function MyAddOn:RefreshConfig()
db = self.db
end