Skip to main content

type

Function type 

Source
pub fn type(x: number) -> option<string>
Expand description

Reveals the subtype of a number.

§Parameters

  • x: any value.

§Return value

The string "integer" if x is an integer, "float" if it is a float, or nil if x is not a number.

§Examples

print(math.type(3))      --> integer
print(math.type(3.0))    --> float
print(math.type("3"))    --> nil

§See also

tointeger, type