[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Concatenating module files...
- From: Duck <duck@...>
- Date: Sat, 21 Jun 2008 18:53:40 +1000 (EST)
Assume I have two modules, banana.lua and mango.lua, implemented in
separate files which I require() separately. Assume that each module
starts with a line like this:
If I simply concatenate the two files into, say, fruit.lua, and change the
module() specifiers so they are like this:
-- rest of banana.lua
--rest of mango.lua
will I get identical results from "require(fruit)" as I used to get
from "require('banana'); require('mango')"?
And if so, is there a way of "escaping" from the most recent call
to module(), for example so that I could concatenate my main program onto
the end of fruit.lua to make a single file with all by require()
dependencies fulfilled inside?
Is it sufficient to prepend:
orig = getfenv(1)
before the first module code and to append: