[texworks] Lua scripting

Stefan Löffler st.loeffler at gmail.com
Mon Jun 8 07:36:36 CEST 2009


Hi,

On 2009-06-07 16:03, Jonathan Kew wrote:
> I saw this patch -- very cool indeed! I'll try to experiment with it
> soon, though it may take some effort to get it building on OS X and
> Windows; should be possible though.

I don't know about OS X (if there isn't some kind of packaging system,
the lua dependencies should be downloadable from lua.org), but for
Windows I've given a rough overview of how I think it could be done on
Google Code (though admittedly I didn't try it). Since I only used the
pure lua C Api (without any wrappers) I, too, think it should be possible.

> One question I've been considering, and still feel undecided about, is
> whether it's preferable to use Lua as a scripting language (partly
> because it is the currently-favoured language in the TeX world), or to
> use the JavaScript-like QtScript, which might have a lot more
> functionality already built into the Qt frameworks. Of course, by
> actually coming up with a patch you may have pretty much settled that
> question! :)

As others here in this thread, I think I'd prefer to implement both and
see what the users prefer. I picked Lua essentially because it's used in
the TeX world, because it was mentioned first on Google Code, and
because I wanted to try it ;). Originally I also was scared off of Qt
extensions because I found the plugin stuff first, which needs compiling
etc. But QtScript could be a viable option.

On a more technical side, by renaming LuaScriptManager to ScriptManager,
writing a new (abstract) base class for LuaScript named just Script and
working with Script instead of LuaScript should make everything much
more expendable. Script would then implement all the get and set methods
of LuaScript, with an abstract run method which should be implemented in
the child classes. And LuaScript would be even simpler, reusing most
code of the Script class and just overriding the constructor and setFile
and add the new method parseHeader.

-Stefan


More information about the texworks mailing list