lua-users home
lua-l archive

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


Le Dimanche 7 juin 2015 11h15, Thijs Schreijer <thijs@thijsschreijer.nl> a écrit :



> The naming of some elements in the C api is a bit misleading. Personally I wish that all wording with "thread"
> would be changed to "coroutine", and the lua_State would be renamed to "executionstack" or something
> more appropriate.

Yes, I totally second that, it's a bit confusing, especially because Lua's thread aren't preemptive.

Thanks for the links, I'll check them if I can't succeed with my current thinking;

> I'm not familiar with Paho, but how is is used? Is the main loop on the C side and are messages passed to Lua
> to be handled with scripting, or is the main loop on the Lua side? Does Paho create the new os threads?
> Do you have control over that behaviour? Does it also generate new Lua states?

Paho ( https://eclipse.org/paho/ ) is a messaging library implementing MQTT protocol, mostly associated with IoT stuffs.
It supports several implementations : Java, C, C++ and even a native Lua library which is not finished up to now.
I'm using the C implementation, which has nothing to do with Lua at all.

My project is the following :

- I have several daemons running in my basement server to do "smart housing", and monitoring several figures of my home : electricity consumption and production, temperature in rooms, pool, health of my Internet connection, and so on and so forth ... https://github.com/destroyedlolo/TeleInfod and https://github.com/destroyedlolo/Marcel are some example of such daemon.
- Daemons and my supervision tool are exchanging data using MQTT messaging : the big advantage is it runs in pub/sub model so I can add / remove / modify any part of my network without touching the remaining.

Now, I'm working now on the "home dashboard" part which will plug-in on this network and will display some valuables informations on a screen on my living room.

- The main work is done in C and takes in charge all the dirty / low level work. This technical layer is https://github.com/destroyedlolo/Selene
- Selene embeds Lua as end user scripting language, which will be used to build the final dashboard (has to be done). And to respond to your question, yes, messages are handled in C then passed to Lua part for end user oriented processing.

The main advantage is a clear separation b/w the technical layers and the end user interface itself.

- Laurent