From ComputerCraft Wiki
Revision as of 18:36, 1 June 2013 by AfterLifeLochie (Talk | contribs) (Now perhaps jesusthekiller won't submit false bugreports.)

Jump to: navigation, search

This function has been deprecated.
This function has been removed from ComputerCraft .

Grid Redstone.png  Function bit.tobits
Converts a number to an array (numerically-indexed table) containing the corresponding binary bit values (the inverse of bit.tonumb)
Syntax bit.tobits(int n)
Returns table the bits making up the value n, with entries up to the most-significant 1 bit in n
Part of ComputerCraft
API bit


Grid paper.png  Example
Convert the number 18 into its binary representation (10010)
for k, v in pairs(bit.tobits(18)) do print(k, ", ", v) end
Output 1, 0
2, 1
3, 0
4, 0
5, 1

As of ComputerCraft 1.42 the bit library has moved to Java code, and as such this function is no longer required or included.