bit.band in v6.0.26 #206
-
Does anyone know the code for bitwise AND function in 6.0.26? bit.band doesn't seem to work anymore. Alternatively does anyone know the library that was used in lua 5.1 for Ctrlr in earlier version, so that I can reimport? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 5 replies
-
I think the error message would say a nil value, not- function value if it doesn’t exist. What is the code snippet you are using? |
Beta Was this translation helpful? Give feedback.
-
I've fixed it. I've saved this module - https://github.com/davidm/lua-bit-numberlua/blob/master/lmod/bit/numberlua.lua as a LUA file and removed the word local from before M on line 183. M.bit.band now works. I'll go through and update my code to use this. I could probably also bring it in as a module, but I'm not sure if modules export into restricted instances. |
Beta Was this translation helpful? Give feedback.
-
I think bit.band does work in version 6.02! bit.band exists in 6.02_1_0_Hell-O-Kitty_2021-03-07_18-05.panel.zip |
Beta Was this translation helpful? Give feedback.
-
There are differences in bit operations depending on the Lua version. The following bitwise operations are possible in Lua 5.1: With Lua 5.3, it will be possible to use the built-in operators: In Ctrlr 6.0.26, it is maybe Lua 5.3... |
Beta Was this translation helpful? Give feedback.
-
I think I found an issue. I was experimenting with base64 encoding (to encode memoryBlocks as strings to support json export), and used a base64Methods library. They have a function called bit. |
Beta Was this translation helpful? Give feedback.
-
In some of my panels I use my own LUA function to replace bit.and and the likes, because I wanted it to work on many different Ctrlr and LUA versions, including older ones.
|
Beta Was this translation helpful? Give feedback.
I've fixed it.
I've saved this module - https://github.com/davidm/lua-bit-numberlua/blob/master/lmod/bit/numberlua.lua as a LUA file and removed the word local from before M on line 183.
M.bit.band now works. I'll go through and update my code to use this.
I could probably also bring it in as a module, but I'm not sure if modules export into restricted instances.