View Single Post
07-21-12, 01:23 PM   #10
Coldkil
A Cliff Giant
 
Coldkil's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 70
Originally Posted by Mikord View Post
For shortening and rounding the numbers, would you guys prefer the nearest thousand or nearest hundred?

For example, 32,765 becomes 33k (nearest thousand) or 32.8k (nearest hundred)?
this is the code i'm using
Code:
lib.siValue = function(val)
	if(val >= 1e6) then
		return ('%.1f'):format(val / 1e6):gsub('%.', 'm')
	elseif(val >= 1e4) then
		return ("%.1f"):format(val / 1e3):gsub('%.', 'k')
	else
		return val
	end
end
so i prefer the nearest hundred would be awesome if the string format could be user-defined instead of fixated. I don't know how complicated would be that anyway