Thread Tools Display Modes
Prev Previous Post   Next Post Next
04-07-22, 09:44 AM   #1
PARRYHOTTEr
A Defias Bandit
Join Date: Apr 2022
Posts: 3
Need to refresh the UI before non-nil value is returned

Hello everyone!

I'm very new to coding addOns to wow, and i've encountered a problem that annoys me.

Whenever i launch the game, GetAverageItemlevel() returns a nil value. If i then reload the UI it will then start to return the expected values.

What i wish to figure out is a way to stop this behaviour of where i have to reload the UI once before the addOn displays the expected value.

The following code is giving me this problem:

Code:
local ilvlText = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
ilvlText:SetPoint("TOPLEFT", 10, -60)
local avgItemLevel, avgItemLevelEquipped, avgItemLevelPVP = GetAverageItemLevel()
ilvlText:SetText("Average equipped ilvl is: " .. tostring(avgItemLevelEquipped or "Refresh UI"))
  Reply With Quote
 

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Need to refresh the UI before non-nil value is returned


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