[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Basic question about modules
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 5 Oct 2010 15:11:40 +0200
On Tue, Oct 5, 2010 at 2:50 PM, Thijs Koerselman
<thijskoerselman@gmail.com> wrote:
> I only know how to do this with setenv, and I'm not sure how to replace it
> with _ENV
AFAIK, it goes like this
local print,tostring = print,tostring -- just like module(), this is a
private environment!
local _ENV = {}
function m1()
...
end
function m2()
...
end
return _ENV
Note that this kind of module has no name - you can put it anywhere in
the filesystem. You have to say 'local m = require 'mod'' because it
does not do any global magic.
steve d.