GetCurrencyInfo returns 0 CurrentAmount
The following code attempts to store the characters name and current count of Prismatic Manapearls into table a once it recognizes that the add-on has been loaded.
The issue I am having is that when iterating through the table, or even just after getting the value, it always returns CurrentAmount as 0. As a test I also iterated through all currencies and their CurrentAmount values, and surprising they were all 0. Is the CurrencyAmount loaded at a later time? Code:
local frame = CreateFrame("FRAME"); |
Instead of ADDON_LOADED, try PLAYER_LOGIN. I assume PearlCount is your saved variable? CurrentAmount should be a local variable.
|
Quote:
Here's the revised code. Code:
local frame = CreateFrame("FRAME"); |
You don't need ADDON_LOADED anymore. Use PLAYER_LOGIN to set up everything including your saved variable.
Added bonus: you won't need to unregister PLAYER_LOGIN as it only fires once, whereas if you stick with ADDON_LOADED you ought to unregister it after you are done setting up. PLAYER_LOGIN > ADDON_LOADED. |
Ah cool, thanks for the tip!
|
All times are GMT -6. The time now is 06:38 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI