<html><body bgcolor="#FFFFFF"><div>Hi Manuel,<br><br></div><div><br>On Aug 9, 2011, at 7:20 PM, Manuel Pégourié-Gonnard <<a href="mailto:mpg@elzevir.fr">mpg@elzevir.fr</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div><span>Hi,</span><br><span></span><br><span>I installed a JSON lua module using the tools of my distro (aptitude install</span><br><span>liblua5.1-json) and it (obviously) works fine with stock lua.</span><br><span></span><br><span>However, I can't easily use it with LuaTeX (tested in texlua mode, kpse not</span><br><span>initialised):</span><br><span></span><br><span> module 'json' not found:</span><br><span> no field package.preload['json']</span><br><span> no file './json.lua'</span><br><span> no file '/usr/local/share/lua/5.1/json.lua'</span><br><span> no file '/usr/local/share/lua/5.1/json/init.lua'</span><br><span> no file '/usr/local/lib/lua/5.1/json.lua'</span><br><span> no file '/usr/local/lib/lua/5.1/json/init.lua'</span><br><span> no file './json.so'</span><br><span> no file '/usr/local/lib/lua/5.1/json.so'</span><br><span> no file '/usr/local/lib/lua/5.1/loadall.so'</span><br><span></span><br><span>The file is there: /usr/share/lua/5.1/json.lua</span><br><span></span><br><span>Probably if I had installed it myself using luarocks it would be in</span><br><span>/usr/local/share and eveything would work, which is great, but it's a bit</span><br><span>frustrating that it doesn't work when the file is installed in /usr/share. For</span><br><span>reference, the search path of my (Debian) stock Lua is as follows:</span><br><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#0023A3"><br></font></font></div></blockquote><blockquote type="cite"><div><span> no field package.preload['nonesuch']</span><br><span> no file './nonesuch.lua'</span><br><span> no file '/usr/local/share/lua/5.1/nonesuch.lua'</span><br><span> no file '/usr/local/share/lua/5.1/nonesuch/init.lua'</span><br><span> no file '/usr/local/lib/lua/5.1/nonesuch.lua'</span><br><span> no file '/usr/local/lib/lua/5.1/nonesuch/init.lua'</span><br><span> no file '/usr/share/lua/5.1/nonesuch.lua'</span><br><span> no file '/usr/share/lua/5.1/nonesuch/init.lua'</span><br><span> no file './nonesuch.so'</span><br><span> no file '/usr/local/lib/lua/5.1/nonesuch.so'</span><br><span> no file '/usr/lib/lua/5.1/nonesuch.so'</span><br><span> no file '/usr/local/lib/lua/5.1/loadall.so'</span><br><span></span><br><span>May I suggest to make texlua's search path look this way too? It looks quite</span><br><span>reasonable and universal (as opposed to distro-specific) this way.</span><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#0023A3"><br></font></font></div></blockquote><div><br></div>Package.path in luatex is initialized according to the stock lua distribution's default. And by that I mean the stock lua from <a href="http://www.lua.org">www.lua.org</a>, not the patched debian version ... and I am sure you see where this is going ...<div><br><blockquote type="cite"><div><span></span><span>PS: I'm aware I can fix package.path in my script before using require, I just</span><br><span>think it would be better if it worked OOTB.</span><br></div></blockquote><br></div><div>... and it would have worked OOTB, if Debian had not altered the lua settings. </div><div><br></div><div>Anyway, have you tried setting LUA_PATH in the environment? If that does not work, then we can think of altering luatex itself.</div><div><br></div><div>Best wishes,</div><div>Taco</div></body></html>