Breaking a byte into 8 booleans - bitRead(x)

Hi,
I’d like to send/receive 8 booleans at once in a byte.

In ardiuino I would do this

numberToSplit=B11000111  
  
boolean1=bitRead(0)  
boolean2=bitRead(1)  
boolean3=bitRead(2)  
boolean4=bitRead(3)  
boolean5=bitRead(4)  
boolean6=bitRead(5)  
boolean7=bitRead(6)  
boolean8=bitRead(7)  

Can a similar action be done in corona?
Thanks

Alex
[import]uid: 66618 topic_id: 20444 reply_id: 320444[/import]

Theres nothing built-in.

You will be able to use the code here:

http://ricilake.blogspot.com/2007/10/iterating-bits-in-lua.html

[import]uid: 108660 topic_id: 20444 reply_id: 80081[/import]

Exactly what I needed, Thanks! [import]uid: 66618 topic_id: 20444 reply_id: 80082[/import]

Corona SDK and Lua do not have bitwise operators like other languages. But there are some modules written by others that will do your bit math for you and gives you a function similar to that.

You need to search on Google and perhaps within the Corona Community submitted code to find them.
[import]uid: 19626 topic_id: 20444 reply_id: 80089[/import]