Http backend at Lua

Typically: "How do I... ", "How can I... " questions
Post Reply
nemilya
Posts: 12
Joined: 11 Feb 2015, 10:02

Http backend at Lua

Post by nemilya »

Hello!

Is it possible to make simple HTTP server at Lua in V-REP?

For example to handle GET requests: http://localhost:port/action etc.

By AddOn, Plugin, script?

Thanks,
Ilya

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

Re: Http backend at Lua

Post by coppelia »

Hello Ilya,

have a look at the demo scene SocketAndTubeCommunicationExample.ttt, which shows something similar. You will basically have to rely on the LuaSocket library for Lua (included in V-REP by default).
But you can always write a plugin that exposes specific functionality if needed.

Cheers

nemilya
Posts: 12
Joined: 11 Feb 2015, 10:02

Re: Http backend at Lua

Post by nemilya »

Thanks!

Is it possible to make socket-server inside V-REP?

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

Re: Http backend at Lua

Post by coppelia »

Normally that should work, we haven't tried it though..
You will have to use a threaded child script for that, and surround your luaSocket code with following instructions:

Code: Select all

simSetThreadIsFree(true)

-- your code (do not access V-REP API functions from here!)

simSetThreadIsFree(false)
Cheers

Post Reply