Lua 5.3 is meant to have the bit32 library compiled in. However, bit32 is nil in Codea. Is it there? If so, how do I access it?


@LoopSpace Bitwise operators are working :slight_smile:

-- And
print(1 & 0)

-- Or
print(1 | 0)

-- Left shift 

print(1 << 2)

-- Right shift

print(4 >> 2)

-- Xor 

print(1 ~ 2)

-- Not / Unary


Thanks for that.

I was trying to use a library that used the bit32 functions which, I thought, were built in. So it looks as though we have inline functions but not normal functions. Or something like that.

(My interest has gone from “I need this” to mere intellectual curiosity now. It was for the hash function for my backup program, but I found a quicker one that rolled its own bitwise operators.)