View Single Post
12-24-18, 08:57 AM   #6
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by Rilgamon View Post
You have the data. So its totally possible to display it.

Lua Code:
  1. if db['Currency'][myPlayerRealm][myPlayerFaction] == ('Alliance') then

In situations like this print out the variables so you can quickly see if the values are what you expect.
Here it seems you mixed up the content and the meaning of the key.
'myPlayerFaction' represents the value you try to compare.
db['Currency'][myPlayerRealm][myPlayerFaction] represents the list of your current faction.
From your described result to list all factions this means you have (at least) two faults here.
It should not be an if-elseif-clause if you want it all printed.

Lua Code:
  1. GameTooltip:AddLine('Alliance:') -- dont put the header in your loop
  2. for name,money in pairs(db['Currency'][myPlayerRealm]['Alliance']) do
  3.   GameTooltip:AddDoubleLine(name, formatMoney(money), 1, 1, 1, 1, 1, 1)
  4. end
Thank You Rilgamon for the help i finally got it figured out and the code you last posted helped dramatically.

Here is a screen shot of the new Tooltip:


Again thank you for the help.

Happy Gaming and Coding to All.
Coke
  Reply With Quote