util.is_int

This commit is contained in:
Mikayla Fischler
2022-06-05 16:51:38 -04:00
parent 1c819779c7
commit 0bc0decbf2
3 changed files with 19 additions and 10 deletions

View File

@@ -79,6 +79,13 @@ end
-- MATH --
-- is a value an integer
---@param x any value
---@return boolean if the number is an integer
function util.is_int(x)
return type(x) == "number" and x == math.floor(x)
end
-- round a number to an integer
---@return integer rounded
function util.round(x)