September 20, 2022


Integers are classified as any rational number that does not contain decimal parts, for example: 1, 2, -5, -2, 90.
When you need a number without a decimal point, you can use an integer. In Lua, there is no specific integer value type, and the numeric value is a double precision floating-point (or just double precision) number.

When handling integers in Lua, note the following:
The decimal part of a number can be math Floor() is rounded off.
You can compare math Floor (x) = = x to judge whether a number is an integer.

Type introspection: you can use type (x) to determine whether a value is a number. When it is a number, both will return the string number.