ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. bitExtract

Function

bitExtract

Server and clientBitwise operationsIdentical to MTA:SA

Extracts count bits starting at position start (0 is the lowest bit). The position and length must fit in 32 bits.

Syntax

int bitExtract(int value, int start [, int count = 1])

Arguments

valueint
The number.
startint
Position of the first bit.
countint, optional = 1
Number of bits.

Returns

The extracted bits or false.

Example

local packed = 0x00ABCDEF
print(string.format("%X", bitExtract(packed, 8, 8)))  -- CD

See also