I'm using this function to round currently:
function round(val, decimal)
if (decimal) then
return math.floor( (val * 10^decimal) + 0.5) / (10^decimal)
else
return math.floor(val+0.5)
end
end
That function works perfectly except that when a number lands on .5 like 5.5 or 1000.5 or 7.5 I need it to round down instead of up. What changes would I have to make to the function to make that happen?