vrep script calling lua-sdl

Typically: "How do I... ", "How can I... " questions
Post Reply
gloria
Posts: 14
Joined: 27 Jan 2016, 08:34

vrep script calling lua-sdl

Post by gloria »

Hello!
I intend to install sdl2.0 on my win7 system, so that it can implement the joystick and v-Rep software interfaces, and I wonder if it is possible?
As far as I know, v-rep scripting language is LUA, and SDL library supports the Lua bindings . LUA-sdl2 source code is available for download.
But I am new here, not knowing how to install lua-sdl2 library under win7 , and call in the script. Have you ever tried it? Or your customers have successfully make it? If so, please tell me what to do, it would be better if you can send me helpful links! Thank you very much!

coppelia
Site Admin
Posts: 10366
Joined: 14 Dec 2012, 00:25

Re: vrep script calling lua-sdl

Post by coppelia »

Hello,

first, make sure to use the Lua-sdl version meant for Lua 5.1
Then, it is normally a matter of dropping a few files/folders in the V-REP folder, then using command require to load the library in the script.

Have a look at how the LuaSocket extension library is used in V-REP: there is folder socket and a few files and folder in folder lua.
Then, if you look at the scene SocketAndTubeCommunicationExample.ttt, in the child script attached to object HttpCommunicationThread you can find one important line:

Code: Select all

http = require("socket.http")
Cheers

Tobias
Posts: 21
Joined: 08 Jan 2016, 14:35

Re: vrep script calling lua-sdl

Post by Tobias »

Hi,

I would recommend you to use Ubuntu for the moment (just copy the SDL.so and SDL created by either luarocks or make to the root folder of V-Rep). I am currently working with this combination and it works just fine.

Compiling lua-sdl on Win 7 doesn't work for me as well. But in case you manage to use lua-sdl on Win, I would be grateful to know how-to.

Cheers,
Tobi

Tobias
Posts: 21
Joined: 08 Jan 2016, 14:35

Re: vrep script calling lua-sdl

Post by Tobias »

Hello everybody,

just as a side note: there is another interace via ffi to sdl2 library (https://github.com/torch/sdl2-ffi). For me it works just fine (windows & linux) and on the side of LUA it should be be better on performance side.

Is there some reason for using bindings over ffi - interfaces?

Tobi

P.S.: Another great binding for audio is openAl-ffi (https://github.com/daurnimator/openal-lua-ffi)

Post Reply