Difference between revisions of "Bit.tonumb"

From ComputerCraft Wiki
Jump to: navigation, search
m (Table -> Table (type))
m (Changed nonexistent type int to type number.)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{lowercase}}
 
{{lowercase}}
 +
 +
{{Deprecated
 +
|type=This function
 +
|version=1.42
 +
}}
 +
 
{{Function
 
{{Function
 
|name=bit.tonumb
 
|name=bit.tonumb
|args=[[Table_(type)|Table]] bit_tbl
+
|args={{Type|table}} bit_tbl
 
|api=bit
 
|api=bit
|returns=[[int (type)|int]] the number resulting from the conversion of <var>bit_tbl</var> from binary
+
|returns={{Type|number}} the number resulting from the conversion of <var>bit_tbl</var> from binary
 
|addon=ComputerCraft
 
|addon=ComputerCraft
 
|desc=Converts an array (numerically-indexed table) containing binary bit values to a number (the inverse of [[bit.tobits]])
 
|desc=Converts an array (numerically-indexed table) containing binary bit values to a number (the inverse of [[bit.tobits]])
Line 14: Line 20:
 
}}
 
}}
 
}}
 
}}
 
As of ComputerCraft 1.42 the bit library has moved to Java code, and as such this function is no longer required or included.
 
  
 
[[Category:API_Functions]]
 
[[Category:API_Functions]]

Latest revision as of 01:53, 12 July 2013


This function has been deprecated.
This function has been removed from ComputerCraft in version 1.42.


Grid Redstone.png  Function bit.tonumb
Converts an array (numerically-indexed table) containing binary bit values to a number (the inverse of bit.tobits)
Syntax bit.tonumb(table bit_tbl)
Returns number the number resulting from the conversion of bit_tbl from binary
Part of ComputerCraft
API bit

Examples

Grid paper.png  Example
Convert the binary representation 10010 into its corresponding value, 18
Code
t = {}
t[1] = 0
t[2] = 1
t[3] = 0
t[4] = 0
t[5] = 1
print(bit.tonumb(t))
Output 18