[luatex] [EXT] Re: Accessing external Lua libraries

Andreas Matthias andreas.matthias at gmail.com
Thu Mar 25 13:31:27 CET 2021


Michal Vlasák wrote:
>
> After adding equivalent of Lua's "?/init.lua" (which across platforms is
> probably a suffix of 'DIR_SEP_STRING "init.lua"') Lua like path
> searching for modules seems to work even in kpathsea. However surely
> there are assumptions in the code that suffix does not contain directory
> separtors and this will break in non simplistic cases. (Like in database
> lookups). Maybe this can be fixed.
>
> But I don't think it's worth to make these changes:

Yes, this makes perfect sense once you understand what's going on.
But imho it's not at all easy to grasp it. Maybe loading an external
library is something that a normal user does not do. But if they
try it, they might come the same cumbersome way as I did:

1) I set {C}LUAINPUTS in texmf.cnf, tested it, and was happy that
I could use external lua libraries/modules. (I didn't know about
luapackageloader back then, and didn't understand package.searchers[].)

2) Later on I realized that I could only load some libraries
but not all. This was weird.

3) Then I realized that it depends on the internal structure of a
module: 'module.lua' vs. 'module/init.lua'.

4) Now, this was the moment I could start asking questions eventually.
Before that I just knew that "something was not working".


Please don't get me wrong. I don't want to complain. I just want to
point out how easy it is to misunderstand the meaning of {C}LUAINPUTS.

Andreas



More information about the luatex mailing list.