[Tex/LaTex] Installing Lua Modules for use in LuaLaTeX – the sequel

installingluatex

There is a question with the same title, Installing Lua Modules for use in LuaLaTeX, that apparently went unresolved. I'm having similar issues and at this point am out of ideas.

I'm running Debian Testing and have installed lua's xmlrpc library through the package manager. The files are installed in

/usr/share/lua/5.1/xmlrpc
/usr/share/lua/5.1/xmlrpc/http.lua
/usr/share/lua/5.1/xmlrpc/init.lua
/usr/share/lua/5.1/xmlrpc/server.lua

and are found alright by the system's lua installation.

I have determined that the package.path parameter differs between the system's lua installation and luatex. System:

mpalmer@holzkopf:~$ lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> print(package.path)
./?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/lib/lua/5.1/?.lua;/usr/local/lib/lua/5.1/?/init.lua;/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua
> 

In luatex, /usr/share/lua and subdirectories are missing from the path. When I set the LUA_PATH environmental variable to the system's path, /usr/share/lua and subdirectories show up in luatex's package.path also, but the xmlrpc module still isn't found. I have also tried to make /usr/local/share/lua (which didn't actually exist) a symlink to /usr/share/lua, again without success.

On the other hand, luatex does not give me an error, so presumably succeeds, with require "socket.http"

That module lives in /usr/share/lua/5.1/socket/http.lua and is found even when /usr/share/lua is neither symlinked nor in package.path. So it almost seems as if package.path is completely ignored by luatex.

Does anyone know what I'm missing here?

Best Answer

See this answer where LuaTeX searches for files loaded by require. require ("socket.http") works, because LuaTeX has this built in (mentioned in the reference manual in section 3.3 "Lua Modules").

Related Question