-->
Page 1 of 1

how to get native bitwise operators?

PostPosted: Wed Feb 24, 2021 7:06 am
by retiredfeline
As I understand it, Lua 5.1 doesn't support native bitwise operators like & and |. However it can be worked around by including the bit module, but then the syntax becomes something like bit.band(a, b) and bit.bor(a,b). I have confirmed that this works by trying these functions on the command line of my ESP8266.

Lua 5.3 supports native bitwise operators, but I don't see a way to instruct nodemcu-build.com to build 5.3 based firmware. Is it possible?

I would prefer to use the 5.3 native bitwise operator syntax for compatibility with my host machine's Lua. If necessary I can do builds on my own PC, I have the toolchain and a clone of the NodeMCU git repo. But I'm hoping to be lazy and use nodemcu-build.com.

Thanks, and sorry if this is already answered somewhere that I didn't find with a search.

Re: how to get native bitwise operators?

PostPosted: Tue Mar 02, 2021 4:06 am
by retiredfeline
Just to let people know that this resolved. I built an image based on Lua 5.3 using my clone of the Git repo. All working well. Used Lua coroutine feature in this experiment: https://hackaday.io/page/10109-bitbangi ... re-support

Re: how to get native bitwise operators?

PostPosted: Mon May 10, 2021 12:23 pm
by John Doe1152
I'm really new to Git and ESP. How did you build the firmware for lua53 ?

Re: how to get native bitwise operators?

PostPosted: Thu Oct 14, 2021 5:49 am
by TerryE
The online documentation explains how. Alternatively use the Cloudbuilder referenced in the docs.