Minetest-WorldEditAdditions/worldeditadditions_commands/utils/numbers.lua

8 lines
222 B
Lua
Raw Normal View History

2020-05-11 03:02:02 +02:00
local we_c = worldeditadditions_commands
-- From http://lua-users.org/wiki/SimpleRound
function we_c.round(num, numDecimalPlaces)
local mult = 10^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end