1

I have a problem to get a lua script (using luasql installed via luarocks) working within lualatex. The lua script basically retrieves data from a mysql database. But within lualatex, the necessary require("luasql.mysql") statement is not working (module 'luasql.mysql' not found). I also tried \usepackage{luapackageloader}, but the require statement is still not working.

I discovered that within a lua shell the commands print(package.cpath) and print(package.path) show the actual correct directories, but outputs generated by \directlua{tex.print(package.cpath)} and \directlua{tex.print(package.path)} within lualatex showing non-existent directories (mainly differing in the version numbers of lua 5.3 vs. 5.4).

Is there any way to update the package path within lualatex? I tried to regenerate all format files without success.

Any help would be appreciated.

BTW: I am using TeX Live 2022 installed on Arch Linux via pacman...

  • the package loader is modified to use kpathsea file paths, like tex, (by default) also loading binary modules disabled unless you use --shell-escape – David Carlisle Jan 31 '23 at 11:03
  • see LUAINPUTS and CLUAINPUTS paths in texmf.cnf – David Carlisle Jan 31 '23 at 11:05
  • LuaTeX uses Lua 5.3, so it's expected that the paths reflect that. If your packages are in version specific paths then you need separate packages for both versions to avoid loading packages which are not compatible with your version. – Marcel Krüger Jan 31 '23 at 13:30
  • lualatex now finds the luasql.mysql module after appropriately adjusting CLUAINPUTS in texmf.cnf but fails to interpret the module due to undefined symbol: lua_newuserdatauv. This might be a version conflict resulting from different lua versions as stated by Marcel, although luasql should work with lua version >5.1. – fermikante Jan 31 '23 at 15:19
  • There are some notes on getting LuaTeX to import external libraries at luatex - Using LuaLaTeX and SQLite3 - TeX - LaTeX Stack Exchange but looks like you already fixed that one. – user202729 Jan 31 '23 at 15:32

0 Answers0