Skip to content

Commit

Permalink
add missing util function
Browse files Browse the repository at this point in the history
  • Loading branch information
Blumlaut committed Oct 13, 2019
1 parent c73c622 commit c3c5622
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions util_shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ function PrintDebugMessage(msg)
PrintDebugMessage(msg) -- recursion?
end
end
end

function math.round(num, numDecimalPlaces)
if numDecimalPlaces and numDecimalPlaces>0 then
local mult = 10^numDecimalPlaces
return math.floor(num * mult + 0.5) / mult
end
return math.floor(num + 0.5)
end

0 comments on commit c3c5622

Please sign in to comment.