-- Начиная с Lua 5.2 в состав стандартной библиотеки входит bit32
bit.tobit(x) -- normalize number to the numeric range of
-- bit operations (all bit ops use this implicitly)
bit.tohex(x[,n]) -- convert x to hex with n digits (default 8)
bit.bnot(x) -- bitwise not of x
bit.band(x1[,x2...]) -- bitwise and of x1, x2, ...
bit.bor(x1[,x2...]) -- bitwise or of x1, x2, ...
bit.bxor(x1[,x2...]) -- bitwise xor of x1, x2, ...
bit.lshift(x, n) -- left-shift of x by n bits
bit.rshift(x, n) -- logical right-shift of x by n bits
bit.arshift(x, n) -- arithmetic right-shift of x by n bits
bit.rol(x, n) -- left-rotate of x by n bits
bit.ror(x, n) -- right-rotate of x by n bits
bit.bswap(x) -- byte-swap of x (little-endian <-> big-endian)
Lua Справочник v0.05 © 2007-2024 Igor Salnikov aka SunDoctor