I looked for information on bitwise operators. Stuff like shift left and shift right, masking using and and or…
There is some information to be found but most are extensions which do not work on vera.
I found some example code with rudimentary HasBit examples. I can make do with these routines for now but I think Vera definitely needs these routines natively.
Did I miss something or are these routines just not there?
[quote=“evanes, post:1, topic:167090”]I can make do with these routines for now but I think Vera definitely needs these routines natively.
Did I miss something or are these routines just not there?[/quote]
They’re just not there. Lua 5.1 doesn’t have bitwise operations natively, and that’s what Vera runs.
I ended up just coding the routines I needed from first principles, using multiplication, division and modulus.
local bit = require("bit")
luup.log("###BitAnd###" .. tostring(bit.band(1, 2)))
luup.log("###BitLeftShift###" .. tostring(bit.lshift(1, 2)))[/code]
I get output like:
[code]50 12/20/10 23:05:05.398 luup_log:0: ###BitAnd###0 <0x2c0c>
50 12/20/10 23:05:05.399 luup_log:0: ###BitLeftShift###4 <0x2c0c>
since the [tt]bit.lua[/tt] is just including [tt]nixio.bit[/tt], and it all seems to be present in my [albeit Beta] MiOS version. There is at least hope that it is coming in UI4’s feature pipeline.