[luatex] external modules from the (Linux) distro

Manuel Pégourié-Gonnard mpg at elzevir.fr
Tue Aug 9 19:20:32 CEST 2011


Hi,

I installed a JSON lua module using the tools of my distro (aptitude install
liblua5.1-json) and it (obviously) works fine with stock lua.

However, I can't easily use it with LuaTeX (tested in texlua mode, kpse not
initialised):

  module 'json' not found:
	no field package.preload['json']
	no file './json.lua'
	no file '/usr/local/share/lua/5.1/json.lua'
	no file '/usr/local/share/lua/5.1/json/init.lua'
	no file '/usr/local/lib/lua/5.1/json.lua'
	no file '/usr/local/lib/lua/5.1/json/init.lua'
	no file './json.so'
	no file '/usr/local/lib/lua/5.1/json.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'

The file is there: /usr/share/lua/5.1/json.lua

Probably if I had installed it myself using luarocks it would be in
/usr/local/share and eveything would work, which is great, but it's a bit
frustrating that it doesn't work when the file is installed in /usr/share. For
reference, the search path of my (Debian) stock Lua is as follows:

	no field package.preload['nonesuch']
	no file './nonesuch.lua'
	no file '/usr/local/share/lua/5.1/nonesuch.lua'
	no file '/usr/local/share/lua/5.1/nonesuch/init.lua'
	no file '/usr/local/lib/lua/5.1/nonesuch.lua'
	no file '/usr/local/lib/lua/5.1/nonesuch/init.lua'
	no file '/usr/share/lua/5.1/nonesuch.lua'
	no file '/usr/share/lua/5.1/nonesuch/init.lua'
	no file './nonesuch.so'
	no file '/usr/local/lib/lua/5.1/nonesuch.so'
	no file '/usr/lib/lua/5.1/nonesuch.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'

May I suggest to make texlua's search path look this way too? It looks quite
reasonable and universal (as opposed to distro-specific) this way.

Manuel.

PS: I'm aware I can fix package.path in my script before using require, I just
think it would be better if it worked OOTB.



More information about the luatex mailing list