lua-users home
lua-l archive

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


On Sun, 23 May 2010, Peter Cawley wrote:
> On Sun, May 23, 2010 at 7:48 PM, Florian Weimer <fw@deneb.enyo.de> wrote:
> > * Stuart P. Bentley:
> >
> >> Also, don't all functions still have an _ENV upvalue? (Unless all
> >> upvalues can be from higher lexical scopes.)
> >
> > Yes, but that's not a problem because it is the same for all functions
> > in a chunk.  You can still move the function to the toplevel, even if
> > it references globals
>
> No, functions will only have an _ENV upvalue if they access a global,
> or have a child function which needs _ENV.

Also functions in a chunk can have different _ENV upvalues if they are in
the scope of a local _ENV declaration.

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
NORTH FITZROY SOLE: NORTHEASTERLY 4 OR 5. SLIGHT OR MODERATE. FOG PATCHES.
MODERATE OR GOOD, OCCASIONALLY VERY POOR.