tags:

views:

255

answers:

2

I'm just starting C++ development using Qt. However, I'm also interested in using Lua to script my app, given various articles stating its development speed (ease) for writing the workflow/ui/glue of an application. However, out of the box Qt doesn't support it, instead it includes QtScript.

My question is basically should I attempt to use Lua with Qt to develop a commercial app, or stick with QtScript available in the SDK? Primarily a development speed vs. stability question I guess.

+1  A: 

Javascript is so well integrated right now, if you want to integrate lua you will probably have a much higher upfront effort. Also the current implementation (4.6) uses the webkit javascript engine, which means it is blazingly fast.

I have used Javascript and Qt for a current project and it was pretty easy to transport data either way (Qt to Javascript, and the reverse)

Harald Scheirich
+5  A: 

I've encountered the same dilemma. I much prefer Lua to ECMAScript for these sorts of tasks. However, as easy as it is to write Lua bindings, the level of integration provided by QtScript yields a lot of capability out of the box. This includes bindings to built-in QObject-derived classes as well as your own classes that inherit from QObject and/or QScriptClass.

So, if you only want to script or configure your own classes independent from Qt functionality, then I'd go with Lua. However, if you primarily want to interact with QObject-based types, then QtScript will greatly decrease your initial development time.

The best of both worlds would be the option to parse Lua scripts with an alternate QScriptEngine implementation. I've been meaning to look into how difficult that would be to integrate for some time...

Judge Maygarden