bit/band

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (local var)
 
Line 20: Line 20:
 
}}
 
}}
 
{{Example
 
{{Example
|Code=a = 170    -- 10101010 in binary form
+
|Code=local a = 170    -- 10101010 in binary form
b = 146    -- 10010010 in binary form
+
local b = 146    -- 10010010 in binary form
 
print( bit.band( a, b ) )
 
print( bit.band( a, b ) )
 
 
|Output=130 (10000010 in binary form)
 
|Output=130 (10000010 in binary form)
 
}}
 
}}

Latest revision as of 15:54, 23 December 2018

 bit.band( )

Contents

Description

Performs the bitwise "and" for all values specified.

Arguments

number value

The value to be manipulated.

Arguments

number otherValues=nil

Values bit to perform bitwise "and" with. Optional.

Returns

number

Result of bitwise "and" operation.

Examples

Example

local a = 170    -- 10101010 in binary form
local b = 146    -- 10010010 in binary form
print( bit.band( a, b ) )

Output:

130 (10000010 in binary form)
Personal tools
Navigation