I'm trying to write this addon to display some XP related numbers in a window. I was able to get it to display as I want it with:
UIConfig.PrintXP = UIConfig:CreateFontString(nil, "OVERLAY", "GameFontNormal")
UIConfig.PrintXP:SetPoint("LEFT", UIConfig.TitleBg, "LEFT", 5, deltaY)
UIConfig.PrintXP:SetText(levelColor .. printXP .. ' ' .. XPPerKill[printXP] .. ' ' .. KillsLeft[printXP] .. '|r')
The problem is that, when the numbers are updated, it writes over the old numbers so both old and new are displayed on top of eachother.
How can I clear the line before writing the new one?
update: I think I figured out what the problem is. I thought that, since I was using PrintXP as a variable, using the code as I did would make an array of UIConfig calls and allow me to change them in a for loop. Looks like UIConfig.PrintXP is a single entity, so when I ran the for loop, it would only clear and reprint the last one.
I did an ugly workaround by creating UIConfig.index1, UIConfig.index2, etc then "if PrintXP == 1 then UIConfig.index1" etc to update them as needed.
New question: Is there a better way to do this?