• When called with no base, tonumber tries to convert its argument to a number. If the argument is already a number or a string convertible to a number, then tonumber returns this number; otherwise, it returns nil.

    The conversion of strings can result in integers or floats, according to the lexical conventions of Lua (see ยง3.1). (The string may have leading and trailing spaces and a sign.)

    When called with base, then e must be a string to be interpreted as an integer numeral in that base. The base may be any integer between 2 and 36, inclusive. In bases above 10, the letter 'A' (in either upper or lower case) represents 10, 'B' represents 11, and so forth, with 'Z' representing 35. If the string e is not a valid numeral in the given base, the function returns nil.

    Parameters

    • e: any
    • Optional base: number
      Optional

    Returns number | undefined

Generated using TypeDoc