Minetest-WorldEditAdditions/worldeditadditions/utils/numbers.lua
2020-05-12 00:38:42 +01:00

5 lines
194 B
Lua

-- From http://lua-users.org/wiki/SimpleRound
function worldeditadditions.round(num, numDecimalPlaces)
local mult = 10^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end