WoWInterface - View Single Post - Possible bug with %d in all format strings
View Single Post
03-24-19, 11:53 PM   #3
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2017
Posts: 12
This was my code used in the example above:
Lua Code:
  1. local scale = self.scale*100
  2. self.scaleText:SetFormattedText("|cffaeaeaeScale|r: |cffffd200%d|r%% |cff666666(change with mousewheel)|r", scale)

My debug output was of both the self.scale and scale values, as well as a string.format output of the same text just to see if it deferred from SetFormattedText().

My self.scale value is only ever added or deducted the exact value of 0.1. But when going down from 1.5, the weirdness started happening. My self.scale variable printed out 1.5, 1.4, 1.3, 1.2 and so on, the scale variable printed out 150, 140, 130, 120 and so on, but the result appearing either in a string after using string.format on it, or directly to the screen in SetFormattedText turned into numbers like 129, 119 and so on.

I thought about how WoW stores positions and scales too, but that's just not the case here. I'm not printing out positions. I'm not retrieving any of these values from GetPoint or GetScale. It's all based on a fully controlled variable.
  Reply With Quote