On live servers I have an AddOn that uses LibDBIcon, and for the most part, it works as intended. For examples, the lock and unlock, and the radius of the button both work fine. However, my options have a setting to hide the button from the minimap, and when I use it, I get an error, and I can't spot what I've done wrong. I lifted the code from other AddOns, and they don't generate the error.
Error:
Lua Code:
3x ...e\Bugger\Libs\LibDBIcon-1.0\LibDBIcon-1.0-34.lua:282: attempt to index field '?' (a nil value)
...e\Bugger\Libs\LibDBIcon-1.0\LibDBIcon-1.0-34.lua:282: in function 'Show'
MyrroUI\MUI_Options.lua:57: in function <MyrroUI\MUI_Options.lua:54>
(tail call): ?
[C]:: ?
[string "safecall Dispatcher[2]"]:9: in function <[string "safecall Dispatcher[2]"]:5>
(tail call): ?
...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0-60.lua:799: in function <...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua:614>
(tail call): ?
[C]:: ?
[string "safecall Dispatcher[3]"]:9: in function <[string "safecall Dispatcher[3]"]:5>
(tail call): ?
Ace3\AceGUI-3.0\AceGUI-3.0-34.lua:314: in function 'Fire'
...ns\Ace3\AceGUI-3.0-34\widgets\AceGUIWidget-CheckBox.lua:68: in function <...ns\Ace3\AceGUI-3.0\widgets\AceGUIWidget-CheckBox.lua:57>
MyrroUI.lua
Lua Code:
local defaults = {
global = {
minimap = {
hide = false,
lock = false,
minimapPos = 205,
radius = 80
}
}
}
function MyrroUI:OnInitialize()
-- databroker stuff, works correctly
DBI:Register("Myrro UI", MyrroUIBroker, self.db.global.minimap)
end
MyrroUI_Options.lua
Lua Code:
miniMap = {
type = "toggle",
order = 20,
name = MINIMAP_LABEL,
desc = L["Show or hide the minimap icon."],
get = function() return not self.db.global.minimap.hide end,
set = function(_, value)
self.db.global.minimap.hide = not value
if value then
icon:Show("MyrroUI")
else
icon:Hide("MyrroUI")
end
end
},
buttonLock = {
type = "toggle",
order = 25,
name = L["Lock Button"],
desc = L["Lock minimap button and prevent moving."],
get = function() return self.db.global.minimap.lock end,
set = function(_, value)
self.db.global.minimap.lock = value
if value then
icon:Lock("MyrroUI")
else
icon:Unlock("MyrroUI")
end
end
},