Quantcast Issue with LibDBIcon and not seeing Ace3 preference database - WoWInterface
Thread Tools Display Modes
10-07-18, 07:48 PM   #1
A Kobold Labourer
Join Date: Jan 2015
Posts: 1
Question Issue with LibDBIcon and not seeing Ace3 preference database

Hi everyone!

Error I'm fighting:

Interface\AddOns\<addon>\minimap.lua:43: attempt to index field 'db' (a nil value)
I'm declaring LDB support -- which was very easy to add and works well with both text and icon based display -- like this:

LDB           = LibStub:GetLibrary("LibDataBroker-1.1")
DBIcon        = LibStub("LibDBIcon-1.0")

Me.LDBButton = LDB:NewDataObject(LDBLongLabel, {
	type          = "launcher",
	icon          = "Interface\\Icons\\inv_misc_dice_01",
	label         = LDBShortLabel,
	text          = LDBShortLabel,
	tocname       = MyTOCName,
	OnClick       = function(clickedframe, button) Me.HandleLDBButtonClick() end,
	OnTooltipShow = function(tooltip)
where LDBLongLabel is a string containing the addon's 'pretty' name (with spaces). LDBShortLabel is another string containing an abbreviated form of the addon's name, and is what shows up in ElvUI's datatext panels in my minimap. Similarly, MyTOCName is a string containing the addon's name with no spaces (the name of its folder, etc).

Guild mates who have installed the addon in icon-based LDB packages see the icon just fine.

Then, I try to offer a minimap button as well:

DBIcon:Register(LDBLongLabel, Me.LDBButton, Me.db.global.MiniMapButton)
This fails with the error at the top of this post -- that's the troublesome line the error stack is calling out. The AceDB database looks like this:

Me.defaults = {
	profile = {
		(a bunch of defaults for UI, etc).
	global = {
		MiniMapButton = {};
as a working addon using this code declared it that way; I've also tried pre-declaring the key
with no difference. It's hung up on not being able to see the database. As far as I can tell, the item declarations match. I'm not sure what I'm missing, but it's probably something similar. Can someone familiar with LibDBIcon be of help?

For now, everything works fine with the DBIcon declaration taken out, so I've done that.
  Reply With Quote
10-07-18, 09:09 PM   #2
Premium Member
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 734
Probably your db is declared later in the loading process.
Make sure to delay the creation of the icon until your db is created.
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Issue with LibDBIcon and not seeing Ace3 preference database

Thread Tools
Display Modes

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