View Single Post
12-22-18, 02:29 PM   #5
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
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
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote