[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Request for ./?/init.lua in the default package.path
- From: Duncan Cross <duncan.cross@...>
- Date: Fri, 29 May 2009 13:12:08 +0100
On Fri, May 29, 2009 at 12:56 AM, David Manura <dm.lua@math2.org> wrote:
> On Thu, May 28, 2009 at 2:42 PM, M Joonas Pihlaja wrote:
>> Can Lua 5.2 have ./?/init.lua in the default package.path?
>
> Or remove the init.lua thing entirely [1].
>
> [1] http://lua-users.org/lists/lua-l/2009-04/msg00389.html
>
I'd disagree with removing it as I like to be able to have a Lua
module that has itself and its submodules contained in one directory:
lua/
mylib/
init.lua
sub1.lua
sub2.lua
...which would be imported by require "mylib", require "mylib.sub1"
and require "mylib.sub2". Sure, I could have
lua/
mylib.lua
mylib/
sub1.lua
sub2.lua
...but to me that is a bit messier, it's better to have a single
"root" file/directory than for it to be all-too-easy to separate a
module from its submodules when copying libs around (especially when
the "lua" folder gets quite full).
-Duncan