Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How easy is Lua with Qt, compared to QtScript?

Tags:

c++

qt

lua

qtscript

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.

like image 795
DaveO Avatar asked Jul 12 '10 10:07

DaveO


2 Answers

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...

UPDATE: QtLua is still actively maintained and might solve your problem directly.

like image 138
Judge Maygarden Avatar answered Nov 17 '22 10:11

Judge Maygarden


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)

like image 1
Harald Scheirich Avatar answered Nov 17 '22 12:11

Harald Scheirich