I was playing around with moving some of the Lua code to a module and ran into a small problem. It appears that require can only find module files in the Octane base directory. I have set up a script directory but if I move the module to that directory Lua can no longer find it. Otherwise I'm having fun with Lua.
require problems
Hi Thomas,
I was playing around with moving some of the Lua code to a module and ran into a small problem. It appears that require can only find module files in the Octane base directory. I have set up a script directory but if I move the module to that directory Lua can no longer find it. Otherwise I'm having fun with Lua.
I was playing around with moving some of the Lua code to a module and ran into a small problem. It appears that require can only find module files in the Octane base directory. I have set up a script directory but if I move the module to that directory Lua can no longer find it. Otherwise I'm having fun with Lua.
Linux Mint 21.3 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 535.171
- stratified

- Posts: 945
- Joined: Wed Aug 15, 2012 6:32 am
- Location: Auckland, New Zealand
hi there,
As a workaround, you could add the path to your directory manually to the package.path variable (this is where Lua searches for modules):
If you want to know more about module loading in Lua, here are the nitty gritty details in:
http://www.lua.org/manual/5.1/manual.html#5.3
I'll make sure we add the configured script directory automatically to the search path in the next release (1.23).
cheers,
Thomas
As a workaround, you could add the path to your directory manually to the package.path variable (this is where Lua searches for modules):
Code: Select all
-- add the directory to the search path, a bit hacky I know :(
package.path = "/home/thomas/dev/?.lua;" .. package.path
require("test")
test.p(10)
http://www.lua.org/manual/5.1/manual.html#5.3
I'll make sure we add the configured script directory automatically to the search path in the next release (1.23).
cheers,
Thomas
