[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Concatenating module files...
- From: Peter Odding <xolox@...>
- Date: Sat, 21 Jun 2008 12:02:17 +0200
I can't say whether you're more interested in the behavior of module()
or just looking for a solution to your problem, but in case it's the
latter, since modules and functions are both chunks you can just wrap
each module in an anonymous function (if I'm not mistaken). You can
emulate nested modules as well:
-- fruit.lua
local modname = ...
(function()
module(modname .. '.banana', package.seeall)
-- rest of fruit/banana.lua
end)()
(function()
module(modname .. '.mango', package.seeall)
-- rest of fruit/mango.lua
end)()
-- back in initial environment of fruit.lua
Hope this helps,
Peter Odding