You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 22, 2023. It is now read-only.
Problem I ran into is that keeping my Remodel scripts in the .remodel directory to make it easier to run them results in issues with require().
This is because all paths are relative to the CWD, so you have to write require(".remodel/modulename") from your scripts, but the problem with this is that dots in pathnames cause issues with requiring.
Would be great if Remodel added the .remodel path to where Lua looks for modules so we can simply write require("moduleName").
The text was updated successfully, but these errors were encountered:
I looked into rlua to see if I could just specify new paths for module discovery, but I was not able to find something like that. Would it make senses to just override the require global? If yes I could make something like this, given this directory structure:
.remodel
foo.lua
dependency.lua
bar
init.lua
baz.lua
utils
copy.lua
Module where require gets called
Module it wants
How
foo.lua
bar
require('bar') or require('./bar')
bar/init.lua
bar/baz.lua
require('./baz') or require('./bar')
bar/baz.lua
dependency.lua
require('dependency') or require('../dependency')
foo.lua
utils/copy.lua
require('utils/copy') or require('./utils/copy')
I'd make it so that it looks for modules in:
same directory as the file it requires from
.remodel directory
Current working directory
I don't think I would go with the same . separator as in stock Lua, I think it's clunky to work with. But at the same time it would make it possible to use existing Lua libraries too...
Problem I ran into is that keeping my Remodel scripts in the
.remodel
directory to make it easier to run them results in issues withrequire()
.This is because all paths are relative to the CWD, so you have to write
require(".remodel/modulename")
from your scripts, but the problem with this is that dots in pathnames cause issues with requiring.Would be great if Remodel added the
.remodel
path to where Lua looks for modules so we can simply writerequire("moduleName")
.The text was updated successfully, but these errors were encountered: