I think there was something called tonumber()
So, yeah. How do I use tonumber()?
Learn to use documentation:
A simple search on the Wiki will result in this page being found:
http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions#tonumber
tonumber
is a function that takes in either one or two arguments.
When given one argument, it returns the decimal number corresponding to the string given, or it may return nil
if the thing given isn't a number:
print( tonumber( "1" ) ) -- 1 print( tonumber( "1." ) ) -- 1 print( tonumber( "1.5" ) ) -- 1.5 print( tonumber( "-5.1e3" ) ) -- -5100 print( tonumber( "5kg" ) ) -- nil print( tonumber( "" ) ) -- nil print( tonumber( "cat" ) ) -- nil
The second, optional argument, is a base. E.g., we can convert from binary:
print( tonumber( "101", 2 ) ) -- 5 -- since 101 in binary is 5