Home Contents | # mpi:fromString | Cipher/MPI | Core4 Lua Commands

## SYNOPSIS

result = mpi:fromString(str[, radix_or_alphabet])

## DESCRIPTION

The Core4 system includes a copy of mbed TLS.

Converts an ASCII string into a number and stores it into the container object.

The variable radix_or_alphabet controls the input format.

When radix_or_alphabet is a number, it specifies the radix (i.e. number base) of the input. Allowed range is 2...36. For bases larger than 10, the decoder uses the letters of the alphabet as additional digits, accepting both upper and lower case.

When radix_or_alphabet is a string, it specifies the conversion alphabet. The input radix equals the length of the alphabet string. The first character in the string is used to encode a zero, the second character encodes the one, and so on.

The default value for radix_or_alphabet is the number 10.

## RETURN VALUE

Returns true on success.

In case of an error returns three values: nil, a string describing the error and a negative error code from the underlying mbed TLS implementation.

## SEE ALSO

mpi:toString