minetest_wadsprint/lib.round.lua

4 lines
137 B
Lua
Raw Normal View History

2019-08-24 07:55:17 -07:00
function round(exact, quantum)
local quant,frac = math.modf(exact/quantum)
return quantum * (quant + (frac > 0.5 and 1 or 0))
end