This still doesn't make any sense to me. I see no API to register module options; I do see two to register module defaults. When I try to register the module options, I get the error telling me that the module is already registered, presumably when I registered the namespace. How then do I assign the options? Is this done with AceConfig, with
appName being the module name? If that is true, which I'm not sure about, will doing so merge the module options with the core options?
addon is defined in the core file, and
module is defined in the module file. This chunk is from the core file.
Lua Code:
-- functions to register module options and check if a module is registered
local moduleOrder = 100
function addon:RegisterModuleOptions(moduleName, optionsTable)
if options.args[moduleName] == nil then
options.args[moduleName] = optionsTable
options.args[moduleName].order = moduleOrder
options.args[moduleName].name = optionsTable and optionsTable.name or moduleName
moduleOrder = moduleOrder + 10
else
error(moduleName .. " is already registered", 2)
end
end
function addon:IsModuleAlreadyRegistered(moduleName)
return options.args[moduleName] and true or false
end
This chunk is in the module file.
Lua Code:
function module:OnInitialize()
self.db = addon.db:RegisterNamespace("Chat", defaults)
db = self.db.profile
self:SetEnabledState(db.enabled)
local options = self:GetOptions()
addon:RegisterModuleOptions("Chat", options)
end
And after all of that, how do I reset the module when the profile is reset via the core file?