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.
eg.
print (bit.tostring (45035996273, 16)) --> A7C5AC471
Lua functions
- bit.ashr - Shifts a number right, preserving sign
- bit.band - Bitwise 'and'
- bit.bor - Bitwise 'or'
- bit.clear - Clears one or more bits
- bit.mod - Bitwise 'modulus' (remainder after integer divide)
- bit.neg - Bitwise 'negate' (ones complement)
- bit.shl - Shifts a number left
- bit.shr - Shifts a number right
- bit.test - Bitwise 'test'
- bit.tonumber - Convert a string into a number
- bit.xor - Bitwise 'exclusive or'
Topics
- Lua LPEG library
- Lua PCRE regular expression functions
- Lua base functions
- Lua bc (big number) functions
- Lua bit manipulation functions
- Lua coroutine functions
- Lua debug functions
- Lua io functions
- Lua math functions
- Lua os functions
- Lua package functions
- Lua script extensions
- Lua string functions
- Lua syntax
- Lua table functions
- Lua utilities
- Scripting callbacks - plugins
- Scripting