Thread Tools Display Modes
04-27-13, 12:22 AM   #1
siweia
A Flamescale Wyrmkin
 
siweia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 126
How to round a number in itemlevel?

===SOLVED===

Hi all,
In this addon Equipped Item Level, my average item level is 500.8, but the problem is that I don't really want any decimal appears.

I changed the "%.1f" to "%d", and the ilvl became 500 which was 501 on my character frame.

is it possible to round up or round down a number in the addon, like what we did in math.

Last edited by siweia : 04-27-13 at 07:10 AM.
  Reply With Quote
04-27-13, 12:45 AM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
floor(ilvl+0.5)
  Reply With Quote
04-27-13, 07:09 AM   #3
siweia
A Flamescale Wyrmkin
 
siweia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 126
Thumbs up

Originally Posted by Dridzt View Post
floor(ilvl+0.5)
Thanks a lot!
  Reply With Quote
04-27-13, 07:33 AM   #4
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Originally Posted by siweia View Post
Thanks a lot!
Just a note that you can also 'abuse' the format specifier to do it.

string.format("%.0f",500.8)
>
501
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » How to round a number in itemlevel?


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