Thread Tools Display Modes
05-25-16, 02:44 AM   #1
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
LibDBIcon usage error

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:
  1. 3x ...e\Bugger\Libs\LibDBIcon-1.0\LibDBIcon-1.0-34.lua:282: attempt to index field '?' (a nil value)
  2. ...e\Bugger\Libs\LibDBIcon-1.0\LibDBIcon-1.0-34.lua:282: in function 'Show'
  3. MyrroUI\MUI_Options.lua:57: in function <MyrroUI\MUI_Options.lua:54>
  4. (tail call): ?
  5. [C]:: ?
  6. [string "safecall Dispatcher[2]"]:9: in function <[string "safecall Dispatcher[2]"]:5>
  7. (tail call): ?
  8. ...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>
  9. (tail call): ?
  10. [C]:: ?
  11. [string "safecall Dispatcher[3]"]:9: in function <[string "safecall Dispatcher[3]"]:5>
  12. (tail call): ?
  13. Ace3\AceGUI-3.0\AceGUI-3.0-34.lua:314: in function 'Fire'
  14. ...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:
  1. local defaults = {
  2.     global = {
  3.         minimap = {
  4.             hide = false,
  5.             lock = false,
  6.             minimapPos = 205,
  7.             radius = 80
  8.         }
  9.     }
  10. }
  11.  
  12. function MyrroUI:OnInitialize()
  13.     -- databroker stuff, works correctly
  14.     DBI:Register("Myrro UI", MyrroUIBroker, self.db.global.minimap)
  15. end

MyrroUI_Options.lua
Lua Code:
  1. miniMap = {
  2.     type = "toggle",
  3.     order = 20,
  4.     name = MINIMAP_LABEL,
  5.     desc = L["Show or hide the minimap icon."],
  6.     get = function() return not self.db.global.minimap.hide end,
  7.     set = function(_, value)
  8.         self.db.global.minimap.hide = not value
  9.         if value then
  10.             icon:Show("MyrroUI")
  11.         else
  12.             icon:Hide("MyrroUI")
  13.         end
  14.     end
  15. },
  16. buttonLock = {
  17.     type = "toggle",
  18.     order = 25,
  19.     name = L["Lock Button"],
  20.     desc = L["Lock minimap button and prevent moving."],
  21.     get = function() return self.db.global.minimap.lock end,
  22.     set = function(_, value)
  23.         self.db.global.minimap.lock = value
  24.         if value then
  25.             icon:Lock("MyrroUI")
  26.         else
  27.             icon:Unlock("MyrroUI")
  28.         end
  29.     end
  30. },
  Reply With Quote
05-25-16, 02:59 AM   #2
VincentSDSH
Non-Canadian Luzer!
 
VincentSDSH's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 350
"Myrro UI" vs "MyrroUI"

You're establishing with one name and trying to control with another; I pass a var for this type of thing for precisely this reason.
__________________
AddonsExecutive Assistant User Configurable To-Do ListLegible Mail Choose the Font for Your Mail

Last edited by VincentSDSH : 05-25-16 at 03:03 AM.
  Reply With Quote
05-25-16, 03:03 AM   #3
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
D'oh. In the Register function. Thanks!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » LibDBIcon usage error


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off