lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello All,

I was somewhat surprised to find out require() searches for
"./testmod.lua" but not "./testmod/init.lua". It usually searches for
both styles. Is this intentional? Or maybe someone just forgot?

I'm working on a tool that generates modules and submodules. It
usually dumps the modules to the current directory. Ideally, I would
like to put all the files in one directory. Like this:

./mod/init.lua
./mod/submod1/init.lua
./mod/submod2/init.lua

But that's not possible if the module is in the current directory. I
would have to do this:

./mod.lua
./mod/submod2.lua
./mod/submod2.lua

I know I'm nitpicking here, but it's not as clean. I know I could
change LUA_PATH, but I think it would benefit everyone if the default
path was a little more consistent. It would be very easy to patch
luaconf.h. Any thoughts?

-- Tim