Under Linux, using Lua 5.1, I have a lua script located under a hidden directory: ~/.texmf/lua/print_table.lua. (It’s LuaTeX-related, that’s why it’s in the texmf dir.) I ran lua interactively from my home directory, tried to require that file, and got the following error messages:
> require('.texmf/lua/print_table')
stdin:1: module '..texmf/lua/print_table' not found:
no field package.preload['.texmf/lua/print_table']
no file './/texmf/lua/print_table.lua'
... [file not found in other - irrelevant - trees, either, of course]
> require('/home/me/.texmf/lua/print_table')
stdin:1: module '/home/me/.texmf/lua/print_table' not found:
no field package.preload['/home/me/.texmf/lua/print_table']
no file './/home/me//texmf/lua/print_table.lua'
...
So, clearly require turns periods into slashes. Escaping the period did not work: I tried doubling the period, sticking a backslash in front of it, and sticking two backslashes in front of it. Is there any way to require a file that has a hidden directory (or any other full stop) in its path?
requireneeds a module name, not a path.You may want to add
/home/me/.texmf/lua/?.luatopackage.pathorLUA_PATH. Then you’ll be able to sayrequire "print_table".