Code:
Spoiler
Thanks to anyone who can help me out with this!
Posted 21 September 2013 - 10:02 AM
Posted 21 September 2013 - 10:26 AM
Posted 21 September 2013 - 10:43 AM
Posted 21 September 2013 - 10:46 AM
Posted 21 September 2013 - 11:33 PM
function round(num) return math.floor(num) end
function chooseColor() if percent < 25 then return colors.red elseif percent < 50 then return colors.yellow end return colors.green end
Posted 22 September 2013 - 04:26 AM
BigTwisty, on 21 September 2013 - 11:33 PM, said:
function round(num) return math.floor(num) endAlthough it would probably be more appropriate to simply use math.floor() inline.
local function round(num) return math.floor(num+0.5) endThat's rounding
local function round(num, idp)
idp = 10^(idp or 0)
if num >= 0 then
return math.floor(num*idp+0.5)/idp
end
return math.ceil(num*idp-0.5)/idp
end
0 members, 1 guests, 0 anonymous users