Thread Tools Display Modes
Prev Previous Post   Next Post Next
07-26-13, 09:42 PM   #22
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Rainrider View Post
Code:
fontString:SetText(format(t[3], value/t[2]):gsub("%.", " , "))
(this would also add spaces before and after the decimal seperator)
Using string functions as metamethods is the slowest possible way to use them. Do this instead:

Code:
fontString:SetText(gsub(format(t[3], value / t[2]), "%.", " , "))
Also, if you're going to be using format directly instead of letting SetFormattedText handle it, you should upvalue format, since TextStatusBar_UpdateTextStringWithValues can be called quite often. Add this at the top of your file, outside of any function:

Code:
local format, gsub = format, gsub
This creates local references to these global functions, so when you call format later, your code is using the faster local reference, instead of a slower global lookup.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » 3 Questions


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