[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

bit.tostring

Summary

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


See Also ...

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 base functions
Lua bc (big number) functions
Lua bit manipulation functions
Lua coroutine functions
Lua debug functions
Lua io functions
Lua LPEG library
Lua math functions
Lua os functions
Lua package functions
Lua PCRE regular expression functions
Lua script extensions
Lua string functions
Lua syntax
Lua table functions
Lua utilities
Scripting
Scripting callbacks - plugins

(Help topic: lua=bit.tostring)

Documentation contents page


Search ...

Enter a search string to find matching documentation.

Search for:   

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]