lua-users home
lua-l archive

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


On Fri, Aug 6, 2010 at 2:25 PM, Jonathan Castello <twisolar@gmail.com> wrote:
> On Fri, Aug 6, 2010 at 2:22 PM, Petite Abeille <petite.abeille@gmail.com> wrote:
>> Which limits one to have a one-to-one representation between module and their physical incarnation. Which is not a step forward as one cannot define multiple modules in one file or a module across multiple files or in dynamically loaded chunks... or any combination of the above. Now instead one will have to mess with package.loaded directly on a case by case scenario, instead of letting module deal with it.
>
> I don't see what prevents you from using require("foo.bar") and
> require("foo.baz") for this purpose. And 5.2 will have a new package.*
> function that lets you locate the path to a named module, which is
> basically require() without actually reading in the file. So you could
> easily create multi-file modules using this.

Continuing: I'm also not sure why you'd want to define multiple
modules in one file, nor do I see how that was possible in any nice or
clear manner with module() anyways. And to load dynamically-loaded
chunks, you just use loadin() to load the chunk with a new _ENV.

-- 
~Jonathan