Returns the numeric value of a string


See also Lua library functions.

Signature:

numValue = tonumber(x [, base])

Arguments:

  • x - A string or number (value)
  • base - Base in which to interpret the numeral (integer between 2 and 36); letters 'A-Z' can be used to denote place values 10 or above in bases greater than 10; defaults to 10 if omitted (number)

Returns:

  • numValue - Numeric value of x in the given base, or nil if the value cannot be converted to a number (number)
This function is defined in the Lua standard libraries