mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-17 18:20:49 +00:00
add round function
This commit is contained in:
Vendored
+9
@@ -0,0 +1,9 @@
|
|||||||
|
-- a real "round" instead of ceil or floor
|
||||||
|
function round(input, places)
|
||||||
|
if not places then places = 0 end
|
||||||
|
if type(input) == "number" and type(places) == "number" then
|
||||||
|
local pow = 1
|
||||||
|
for i = 1, places do pow = pow * 10 end
|
||||||
|
return floor(input * pow + 0.5) / pow
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user