Garry's Mod Wiki

Revision Difference

bit.band#514060

<function name="band" parent="bit" type="libraryfunc">⤶ <description>Performs the bitwise "and" for all values specified.</description>⤶ <realm>Shared and Menu</realm>⤶ <args>⤶ <arg name="value" type="number">The value to be manipulated.</arg>⤶ <arg name="otherValues" type="number" default="nil">Values bit to perform bitwise &quot;and&quot; with. Optional.</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="number">Result of bitwise "and" operation.</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <code>⤶ local a = 170 -- 10101010 in binary form⤶ local b = 146 -- 10010010 in binary form⤶ print( bit.band( a, b ) )⤶ </code>⤶ <output>130 (10000010 in binary form)</output>⤶ ⤶ </example>