Lua string to int

lua

How can I convert a string to an integer in Lua?

I have a string like this:

a = "10"

I would like it to be converted to 10, the number.

Best Solution

Use the tonumber function. As in a = tonumber("10").

Related Question