问题描述
为了使它正常工作,我一直在苦苦挣扎.有人可以提供一个示例,其中包含2个脚本的任何LUA api来回传递消息.
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.
我尝试了机油, lua-ipc 和 zeromq .但是我遇到了几个缺少的库问题.
I have tried Oil, lua-ipc and zeromq.But I face several missing libraries issues.
最终的目标是将数字向量从一个Lua进程传递到另一个Lua进程(具有不同版本的Lua)而无需通过磁盘.
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.
在单个文件中,这是IPC python中类似的示例. lua中类似的内容将非常有帮助.
Here is a similar example in python of IPC in a single file. Something similar in lua would be extremely helpful.
我真的需要一个示例,因为我对管道或UDP/TCP的了解不深.
I really need an example as my knowledge in pipes or UDP/TCP is not strong.
推荐答案
等效项是使用luasocket.这些示例非常接近给出的python示例.这里的socket:receive()用于框架.
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
这篇关于Lua中的进程间通信与示例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!