-
I'm making a program that will look for lua files in some other directory than the one it runs in, and I'd like require to work as if it's relative to that directory/file. I can't change the directory the program runs in, as that messes up the file watcher from notify by the looks of it. How do I do this properly? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I've done this with |
Beta Was this translation helpful? Give feedback.
-
ah thanks, looks like LUA_PATH is what I want |
Beta Was this translation helpful? Give feedback.
I've done this with
sile
, and more besides. You have to set thepackage.path
andpackage.cpath
inside your VM because the mlua one by default doesn't have the same set of paths that might be searched as a standalone PUC Lua or LuaJIT VM does. In my case I've added paths relative to CWD, relative to the current detected project, relative to the user, and relative to the system default as detected by running the system Lua at build time so I can make sure the paths are supported.