[Interest] Adding Scripting Capabilities to my Application (Suggestions on how to get started)

Josh Handley jhandley at lkc.com
Wed Mar 12 19:47:59 CET 2014


We have used Lua as an embedded scripting language. It is very lightweight,
cross platform and easy to integrate with C/C++. The language grew out of
the need for "smarter" configuration files which it sounds like is what you
want. It isn't part of Qt but we have had a very good experience using it
with Qt. Most people embed the Lua interpreter in their software so that the
user doesn't have to have anything installed on their system.  On Windows
the compiled lua interpreter plus standard libraries are less than 250K.

One great feature that Lua has that you don't get in Javascript is
co-routines. You can write run your Lua code as a co-routine and have it
yield back to C++ so Qt can run its event loop and resume the Lua code on
certain events. This lets you write Lua code that looks like straight-line
code even though it runs inside an event based system.

Josh




-----Original Message-----
From: interest-bounces+jhandley=lkc.com at qt-project.org
[mailto:interest-bounces+jhandley=lkc.com at qt-project.org] On Behalf Of
Michael Jackson
Sent: Wednesday, March 12, 2014 2:06 PM
To: <interest at qt-project.org>
Subject: [Interest] Adding Scripting Capabilities to my Application
(Suggestions on how to get started)

Hello Qt Community. 
   I help develop a combination of library/application
(dream3d.bluequartz.net) and we would like to add some scripting
capabilities to it. I'll  state what I _think_ I want and hopefully get a
sanity check as to whether it is really possible or not.

 Our project as a main Application that is GUI based and is the user facing
portion. It allows the user to setup a Pipeline of "filters" to be run on a
set of data. We have separated the "View" parts from the "model" parts and
so we can actually execute a pipeline from the command line by feeding it a
special .ini file that describes the inputs for each filter in sequence.
What I think we would like to add is the ability to write "script" file that
allows more than just running the filters in sequence but would also add all
the basic language features such as loops and conditionals. So I am
envisioning someone writing something like a JavaScript file that would be
executed. The script file would contain all the logic to drive a pipeline or
multiple pipelines or variations on a pipeline or something like that.
Basically, a way to hook together our filters but NOT have to do a full
blown compile of the codes. I took a look at QML, QtScript and something
else but I am really jus  t getting confused at this point. It was suggested
to wrap all of our classes in Python or Java or Ruby. I was really hoping to
be able to utilize something built into Qt (Qt4 currently but we are working
to move to Qt5) so that I didn't have to ensure the user has the proper
scripting language installed on their systems (OS X, Linux & Windows).

So I would sincerely appreciate any suggestions or personal experiences from
the Qt community about how to proceed or where to look for more examples. 


Thanks
--
Mike Jackson
http://dream3d.bluequartz.net    ::::::::::
http://www.github.com/dream3d/DREAM3D


_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest





More information about the Interest mailing list