Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Advertisement

Sets the text displayed in the font string using format specifiers. Equivalent to :SetText(string.format("format", value)), but does not create a throwaway Lua string object, resulting in greater memory-usage efficiency.

 FontString:SetFormattedText("format" [, arg1, arg2, ... ])

Arguments[]

format
String - A string containing format specifiers (as with string.format()).
arg
A list of values to be included in the formatted string.

Example[]

The following snippet does set MyFontString to players attackspeed with 2 decimals.

local mhSpeed, ohSpeed = UnitAttackSpeed("player");
fontString:SetFormattedText("%.2f", mhSpeed)


The following code is to show that its possible to switch :SetText with :SetFormattedText

fontString:SetFormattedText("Hello World")

Patch changes[]

See also[]

Advertisement