decimal point/full number
Hello,
I got a code for my raidframes to show health with one decimal point. Example: 44100 = 44.1k When the health is under 1k: 910 = 0.9k But I want it to display the full number when under a thousand so 910 instead of 0.9k. Can someone help me with this code: Code:
hooksecurefunc("CompactUnitFrame_UpdateStatusText",function(self) |
Here you go. I also future-proofed it by formatting higher numbers, if you ever run into that.
Lua Code:
|
Thank you so much for the fast reply.:)
I used/ripped similar codes for my weakauras but I still rly have no exact clue how they work (lua format/decimal values). I tested it out and it showed 658 as 658.000000 I changed %f in line 2 to %s and it seems to work now but I dont know if it interferes with the code itself :rolleyes: |
"%.1f" means to format the number as a string with just one floating decimal point. "%.0f" means to format the number with 0 decimal places. I have no idea why you are getting many trailing zeros.
Alternately, you can replace that line with this: Lua Code:
|
It was originally just %f, but I edited my post after their reply to be %.0f instead.
|
Its working fine now, thank you both so much :)
|
All times are GMT -6. The time now is 11:05 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI