In Lua 5.2 or earlier, both `tostring(10)` and `tostring(10.0)` result as the string `"10"`.

In Lua 5.3, this has changed:

``````print(tostring(10)) -- "10"
print(tostring(10.0)) -- "10.0"
``````

That's because Lua 5.3 introduced the integer subtype. From Changes in the Language:

The conversion of a float to a string now adds a `.0` suffix to the result if it looks like an integer. (For instance, the float `2.0` will be printed as `2.0`, not as `2`.) You should always use an explicit format when you need a specific format for numbers.

### c - Lua - Number to string behaviour - Stack Overflow

https://stackoverflow.com/questions/36031078/lua-number-to-string-behaviour

In Lua 5.2 or earlier, both tostring(10) and tostring(10.0) result as the string "10" . In Lua 5.3, this has changed: print(tostring(10)) -- "10" ...

### What is tostring() in Lua?

In Lua, you can convert a number to a string using the tostring() function. 10 ...

### Lua string to int - Stack Overflow

https://stackoverflow.com/questions/10962085/lua-string-to-int

Lua just does automatically conversion between strings and numbers. If you want ensure the type, use a = tonumber(a). – xpol. Feb 26, 2016 at 3:52.

### Convert integer to string, in Lua

https://programming-idioms.org/idiom/55/convert-integer-to-string/1315/lua

Idiom #55 Convert integer to string · S : String := Integer'Image (I); · #include <stdlib.h>. char s[0x1000]={}; itoa(i,s,10); · (let [s (str i)]) · #include < ...

### Programming in Lua : 2.4

https://www.lua.org/pil/2.4.html

Strings have the usual meaning: a sequence of characters. ... We can specify a character in a string also by its numeric value through the escape sequence ...