[Dev-luatex] dofile, require and kpathsea

Hans Hagen pragma at wxs.nl
Tue Aug 21 10:49:09 CEST 2007


Jonathan Sauer wrote:
> Hello,
> 
> during the weekend, I wrote a little bit of code using external
> Lua files (since \directlua requires matching braces in the
> Lua code). I loaded this code using dofile or require.
> 
> This worked perfectly when the .lua file was in the same
> directory as the .tex file, otherwise it was not found
> (even though kpsewhich could find it).
> 
> I know that Lua's require uses its own search path, and I
> assume from my results that LuaTeX does not change this
> behaviour to use kpathsea.
> 
> I now wonder if there are plans to change that. IMO this
> should be done, since LuaTeX embeds Lua in a very specific
> environment which searches for files using kpathsea, not
> a simple path set as an environment variable.
> 
> What do you think?

there will be a LUAINPUTS variable in texmf.cnf and then you can use 
that to specify paths

since those lua files are tex relates, you can just put 'm in the tex 
path and use the tex related kpse lookup

"dofile" etc will not be adapted to kpse based loading since in 
principle this is pure lua, but you can easily write a wrapper, say 
"doluatexfile" that first locates the file (using kpse) and then does it.

-----------------------------------------------------------------
                                           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 dev-luatex mailing list