So I've been running at this thing with the following script in WoWLua:
Lua Code:
print('--------------------------------------------------')
local xb = LibStub('AceAddon-3.0'):GetAddon('XIV_Databar')
--local mmm = xb:GetModule('MenuModule')
function printTable(table, prefix)
for k,v in pairs(table) do
if type(v) == 'table' then
printTable(v, prefix..'.'..k)
else
print(prefix..'.'..k..': '..tostring(v))
end
end
end
printTable(xb.db, 'db')
Then stripped my addon down to as basic as I could. My OnInit only does AceDB:New, LSM:Register, self.frames = {}, sets up an options table (statically), then registers the options frame, and a slash command. My OnEnable has been set to just return.
If I run that after loading into the game it's completely missing self.db.profile. After I load up my config it fills in self.db.profile with my defaults.
The full OnInit/OnEnable/ToggleConfig:
Lua Code:
function XIVBar:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("XIVBarDB", self.defaults)
self.LSM:Register(self.LSM.MediaType.FONT, 'Homizio Bold', self.constants.mediaPath.."homizio_bold.ttf")
self.frames = {}
local options = {
name = "XIV Bar",
handler = XIVBar,
type = 'group',
args = {
general = {
name = L['General'],
type = "group",
order = 3,
inline = true,
args = {
barPosition = {
name = L['Bar Position'],
type = "select",
order = 1,
values = {TOP = L['Top'], BOTTOM = L['Bottom']},
style = "dropdown",
get = function() return self.db.profile.general.barPosition; end,
set = function(info, value) self.db.profile.general.barPosition = value; self:Refresh(); end,
},
barColor = {
name = L['Bar Color'],
type = "color",
order = 2,
hasAlpha = true,
set = function(info, r, g, b, a)
XIVBar:SetColor('barColor', r, g, b, a)
end,
get = function() return XIVBar:GetColor('barColor') end
},
}
}
}
}
options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
options.args.profiles.order = 90
LibStub("AceConfig-3.0"):RegisterOptionsTable(AddOnName, options)
self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(AddOnName, "XIV Bar")
self:RegisterChatCommand('xivbar', 'ToggleConfig')
end
function XIVBar:OnEnable() return; end
function XIVBar:ToggleConfig()
InterfaceOptionsFrame_OpenToCategory(self.optionsFrame)
end