lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

On Sat, 2021-02-27 at 04:28 +0000, caco wrote:
> From C I have master process in parallel with number of agent
> processes each binding a luaL_State. I want the agents Lua scripts to
> communicate through Lua supervised (i.e. gc'd) data. How can I do
> this? 

You may have a look on my Séléné framework : destroyedlolo/Selene


My smart home automation is fully MQTT driven and is a mix of C / C++ and Lua so I was needing fully multi-threaded solution.
In Selene, new thread can be created when MQTT messages arrives or you can detach your own processes.
Processes can communicate using shared variables, shared collections of data (potentially multi-valued and timed), messages and TODO queues (sharing Lua code b/w thread is resource consuming, so a sub task can queue only a  reference of functions it want to be launched on another one - very light).
In addition, there are optional plugins to created dashboard directly on Linux framebuffer so X is not needed or on tiny Oled screen.

Unfortunately, almost no documentation but comment in the source code and large brunch of comprehensive examples.
Obviously if someone want to participate, he's welcome :)

Bye

Laurent