Skip to content

Make require work for files in a different directory #457

Closed Answered by alerque
Dimev asked this question in Q&A
Discussion options

You must be logged in to vote

I've done this with sile, and more besides. You have to set the package.path and package.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.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Dimev
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants