[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 5.2 and 5.1
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 11 Apr 2013 09:50:38 -0300
> And that code can use any style... e.g. lpeg's re uses _ENV
> and luasocket still uses module().
LPeg's re does not use _ENV. It explicitly builds its table and returns it.
Anyway, can't you hanlde all them the same way, by packing each module
inside a function, more or less like this?
do -- module A "inlined" here
local _ENV = _ENV
local function mod (...)
<<module original source code>>
end
package.preload.A = mod
end
do -- module B "inlined" here
...
end
-- main code
local x = require'A'
...
-- Roberto
- References:
- Re: 5.2 and 5.1, Dirk Laurie
- Re: 5.2 and 5.1, steve donovan
- Re: 5.2 and 5.1, Dirk Laurie
- Re: 5.2 and 5.1, steve donovan
- Re: 5.2 and 5.1, Dirk Laurie
- Re: 5.2 and 5.1, Petite Abeille
- Re: 5.2 and 5.1, Pierre-Yves Gérardy
- Re: 5.2 and 5.1, Petite Abeille
- Re: 5.2 and 5.1, Pierre-Yves Gérardy
- Re: 5.2 and 5.1, steve donovan