Bitwise shift and logical operators in Lua script inside V-REP v3.4
Posted: 02 Jun 2018, 13:13
This question isn't directly related to V-REP.
I have little experience of programming in Lua. I am trying to convert the following statement from C to Lua language-
From the Google, I found that the following bit = require('bit') library can perform the bitwise operations. The function bit.lshift(x, n) perform bitwise shift operation. However, it shows following error in my machine-
My goal is to write int rgb = r << 16 | g << 8 | b in Lua script inside V-REP v3.4.
Please note that I am using Ubuntu 14.04 LTS 64 Bit OS.
I have little experience of programming in Lua. I am trying to convert the following statement from C to Lua language-
Code: Select all
int rgb = r << 16 | g << 8 | b;
Code: Select all
Lua runtime error: [string "SCRIPT myScript"]:29: module 'bit' not found:
no field package.preload['bit']
no file './bit.lua'
no file '/usr/local/share/lua/5.1/bit.lua'
no file '/usr/local/share/lua/5.1/bit/init.lua'
no file '/usr/local/lib/lua/5.1/bit.lua'
no file '/usr/local/lib/lua/5.1/bit/init.lua'
no file '/home/ravi/V-REP/lua/bit.lua'
no file '/home/ravi/V-REP/BlueWorkforce/bit.lua'
no file '/home/ravi/Desktop/V-REP/bit.lua'
no file './bit.so'
no file './libbit51.so'
no file '/usr/local/lib/lua/5.1/bit.so'
no file '/usr/local/lib/lua/5.1/libbit51.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
Please note that I am using Ubuntu 14.04 LTS 64 Bit OS.