[texworks] Lua scripting

Hans Hagen pragma at wxs.nl
Sun Jun 7 16:13:14 CEST 2009


Stefan Löffler wrote:
> Hi,
> 
> it's been a while since I've been active on this list or TW in general
> since I had a lot of stuff to do recently. This weekend I finally had
> some free time and so I decided to implement Lua scripting for TW,
> something that's been on the whishlist for a long time and that has been
> asked for repeatedly.
> 
> For details on the implementation and the patch itself, see
> http://code.google.com/p/texworks/issues/detail?id=27
> 
> Right now it's rather limited, but working. I included two sample
> scripts that don't do much (I just started Lua seriously yesterday ;))
> but show off what could be done in the future. Since this introduces
> rather extensive changes including new dependencies of the code (on the
> lua library), I hope there are some people out here who help me by
> building it (possibly reporting how to satisfy the new dependencies) and
> testing it. One day I hope Jonathan will find it stable enough to commit
> it to the repository.
> 
> Looking forward to your comments.

i have to wait til there is a windows binary, but looking at the txt 
file, why this syntax?

Each script file must start with a special header. The header must start 
with

{{{
--[[TeXworksScript
}}}
followed by a number of
{{{
key: value
}}}
pairs and finished off by the line
{{{
]]
}}}

why not just create a texworks table

texworks = {
    key1 = value1,
    key2 = value2,
}

after loading the script, the lua instance in texworks can check this 
table (no parsing of the lua file needed)

apart from this better fitting in the lua syntax than {{{ }}} it also 
makes syntax checking easier when writing scripts

Hans



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the texworks mailing list