Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interprocess communication in Lua with Example?

I have been struggling a lot to get this to work. Can someone provide an example with any LUA api of 2 scripts that pass a message back and forth.

I have tried Oil, lua-ipc and zeromq. But I face several missing libraries issues.

The ultimate goal is to pass a vector of numbers from one Lua process to another Lua process (with a different version of Lua) without going through disk.

Here is a similar example in python of IPC in a single file. Something similar in lua would be extremely helpful.

I really need an example as my knowledge in pipes or UDP/TCP is not strong.

like image 496
nico Avatar asked Dec 14 '25 18:12

nico


1 Answers

The equivalent would be to use luasocket. These examples come very close to the python example given. Here socket:receive() is used for the framing.

https://github.com/diegonehab/luasocket/blob/master/samples/listener.lua

https://github.com/diegonehab/luasocket/blob/master/samples/talker.lua

like image 141
TheMadsen Avatar answered Dec 19 '25 00:12

TheMadsen