Use the tonumber
function. As in a = tonumber("10")
.
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.
To convert a string to a number, use the tonumber() function. If the string doesn't have a number representation, then the tonumber() function returns nil.
Converting Strings You can easily convert a string to a number by using the tonumber() function. This function takes one argument (the string) and returns it as ...
Lua denotes the string concatenation operator by " .. " (two dots). If any of its operands is a number, Lua converts that number to a string.
I : Integer := Integer'Value (s); · #include <stdlib.h> · #include <stdlib.h> · (def i (Integer/parseInt s)) · (def i (Integer. s)) · #include <cstdlib>. int i = std ...
S : String := Integer'Image (I); · #include <stdlib.h>. char s[0x1000]={}; itoa(i,s,10); · (let [s (str i)]) · #include <string>. auto s = std::to_string(i);.