WoWInterface - View Single Post - Ace3: Profile reset does not refresh config dialog?
View Single Post
03-06-20, 06:54 PM   #3
A Pyroguard Emberseer
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,121
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.

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

function MyAddOn:RefreshConfig()
    db = self.db
  Reply With Quote