bit.tostring

Convert a number into a string

Prototype

s = bit.tostring (n, base)

Description

This takes a number, and converts it into a string to the given base, in uppercase. The base is optional and defaults to 10. The base can be in the range 2 to 36. Fractional parts are discarded, as the number is first converted to a 64-bit number internally. Negative numbers are OK, and will be converted with a leading "-" sign.

eg.

print (bit.tostring (45035996273, 16)) -->  A7C5AC471

Lua functions

Topics