[solved] Scripting: JS API or something else?
"Which scripting language should I use?" is a frequently asked question. But I think this time is a bit different, and I hope you will still answer.
I read in the documentation that Qt integrates a "JS API":http://qt-project.org/doc/qt-5.0/qtdoc/topics-scripting.html capable of running JSON scripts. I'm thinking of an application that could make a great use of scripting, where I would implement a plugin system using scripts. This means a very huge data exchange between C++ and the scripts.
The reason I'm bothered is because I previously scripted in Lua and I love it!
The main choice would be between Lua and the integrated JS API where I would choose Lua because I know it's fast, powerful, reliable; but I'd choose the integrated JS API because it's integrated and would save me a lot of time (and probably, troubles).
So, which one would you suggest and why?
Also, if someone used Lua with Qt before could you tell me how it performs and if you had any troubles?
I have not yet integrated Lua into a Qt-application, but I plan to do it. Depending on how much you need, you may want to look into "QtLua":http://www.nongnu.org/libqtlua/ or do the whole thing yourself. Since Lua uses a very compact library, I don't really see any downsides. Its performance with Qt should be the same as with any other C++ software - unless you bury it very deeply.
I recently integrated Python into an application, manually. And in total it took a couple of days, because I had never done anything with Python before and the C API could have used a better documentation. So the amount of work is manageable, and I suspect that Lua makes it easier to be integrated (and when in doubt, take a look into QtLuas sources).
I'd say: You'll have to invest some time anyway, either to learn JS or to integrate Lua. It might be faster overall to go for the latter, if you already know the language well. In my case I wanted the end-user to be able to extend the application, so that needed to be taken into account, too.
In short: I suggest Lua, I don't see any drawbacks there. If nothing else, it'll enable you to compare both languages regarding their performance.
From what I can see on the web, JS has a very easy syntax. It's very similar to C/C++ and even to Lua for the basic types available, so I could get used to it in no time.
Thanks for your good words about Lua. If you'll integrate Lua in Qt any soon I'd appreciate very much if you could tell me what your experience was - just to have a better idea of how things go on between them.
Thank you again and I'll wait for other's replies too :)