pub fn tointeger(x: number) -> option<number>Expand description
Converts a value to an integer, if possible.
§Parameters
x: any value.
§Return value
If x is convertible to an integer (an integer, a float with an
integral value that fits, or a string that reads as one), returns
that integer; otherwise, returns nil.
§Examples
print(math.tointeger(3.0)) --> 3
print(math.tointeger(3.5)) --> nil
print(math.tointeger("42")) --> 42§See also
floor, math.type