-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support lua scripting #69
Comments
As far as I know Wiebe's intentions, a big part of FlashMQ's design philosophy is to have a minimal set of dependencies; another is to do one thing and to do it well. In my opinion, built-in Lua support would add needless complexity and an extra dependency. Though the latter could be configurable at compile-time, that in itself creates more packaging choices and difficulties. The best approach for those wishing to work with Lua (or any other scripting language for that matter) would be to write a plugin (in C++) that adds support for that language. FlashMQ's plugin ABI is stable, and, since there's not much you can't do with a plugin within FlashMQ's plugin architecture, implementing scripting support shouldn't be hugely difficult. However … another cornerstone of FlashMQ is performance, and I would venture that in most cases it would be unwise to surrender some of that performance to the drag imposed by an interpreted language. Then there is the matter of type safety. FlashMQ is written in strongly-typed C++ to make it as fault-free as possible. A quick Google reveals that there are a number of competing approaches to make Lua more strongly type than the baseline language. All in all, I can't speak for Wiebe, but I think that adding Lua suport to FlashMQ itself would be a mistake. As for a plugin that adds Lua support: I think it can work fine, but would strongly advice to invest that energy in becoming a bit more comfortable in C++. Who doesn't want a non-scripting language on their CV after all? |
May I ask, @penguinol, if you have some specific plugin functionality in mind to make you wish you could implent it in Lua? I'm asking because there are plans for a bunch of example C++ plugins, so that it will be less daunting for novice C++ programmers to build on these examples for most trivial needs, and it will be good to have some concrete needs and wishes in the back of our heads when creating these examples. |
I'm a C++ programmer, but i don't think everything must be implemented in C++. |
@bigsmoke said it. A plugin for Lua may be good idea just to have, however:
I suspect the way this will be implemented would be a blocking/synchronous call. An SQL query can take a few milliseconds easily, which is an eternity in FlashMQ time. You may as well then use other brokers that do support Lua. For HTTP calls, there is an example plugin for async libcurl to avoid blocking calls, and I suspect that will be impossible to implement with Lua. Or, at least write as technical debt from the start (quick to set up, inflexible/limited later). |
@halfgaar , I think you can close this issue? |
After some consideration, I agree. I'm all for people developing a lua plugin, but as a core feature, I have to conclude that it's not the most logical feature. FlashMQ's fast, fully async model is too easily undermined with lua. |
Lots of MQTT broker support lua scripting, such as vernemq and emqtt.
Lua can make it easier to develop plugins.
The text was updated successfully, but these errors were encountered: