[texworks] My Lua script doesn't find lpeg library

Stefan Löffler st.loeffler at gmail.com
Sun May 25 11:48:17 CEST 2014


Hi,

Am 24.05.2014 15:13, schrieb Christophe Devalland:
> 2014-05-23 23:09 GMT+00:00 Reinhard Kotucha <reinhard.kotucha at web.de
> <mailto:reinhard.kotucha at web.de>>:
>
>     It shouldn't be necessary to install an external Lua.  
>
>
> Great !
>  
>
>     Doesn't TeXworks use texlua?  The latter has lpeg compiled-in.
>      And I strongly recommend to use texlua due to its built-in
>     modules and extensions.
>

No. On Linux, Tw relies on the system lua library. On Windows, Tw is
built as a single, large, monolithic program with all libraries linked
in statically. In the case of Lua, this is 5.2.2 ATM. So you don't need
either texlua or a standalone lua installation.

>     Can you provide a minimal example which allows developers to reproduce
>     the problem?
>
>
> yes, I give you a "pb_lpeg.lua" to put in texworks/scripts directory.
> (Don't forget to activate script langages in preferences). Call this
> script and you have an error to load lpeg.

It worked for me when installing Lua for Windows and subsequently
putting lpeg.dll into the directory containing TeXworks.exe (this is
different from Linux, where it worked for me when putting lpeg.so into
the directory where the script was).
Note, though, that while this worked for Tw 0.4.5 (which was compiled
with Lua 5.1), it no longer works for recent Tw 0.5 (which is compiled
with Lua 5.2). The reason for this seems to be that Lua for Windows uses
Lua 5.1, which apparently is incompatible with Lua 5.2 used in Tw (in my
tests, it caused Tw to crash).
BTW: lpeg.dll needs lua51.dll (from the Lua on Windows install) to run.
I don't know if/how lua51.dll talks to Tw, so maybe you find some
inconsistencies when using lua modules in dll form (in the sense that
some global settings are not propagated to the module or something). But
then again, Lua is a scripting language, so maybe all settings are
stored on some common stack or something and there won't be any problem.

HTH
Stefan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20140525/6ec96b08/attachment-0001.html>


More information about the texworks mailing list