lua-users home
lua-l archive

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


Forgive me if this is a stupid question, but is _ENV going to be a
real variable that's accessible from the script, or a hidden
"internal" variable? If it's a real variable, forgive a second stupid
question: why not assign it to _G instead? I'm not trying to
second-guess anyone, I'm just honestly not sure I understand the
current situation.

~Jonathan

On Wed, Feb 24, 2010 at 10:07 PM, David Manura <dm.lua@math2.org> wrote:
> On Thu, Feb 25, 2010 at 12:03 AM, David Manura wrote:
>> The _ENV or in/do proposals eliminate that restriction, at least on blocks
>
> Or handled in expressions sort-of too, as Roberto suggested:
>
>   local o = with(shape)(function(_ENV) return rectangle { point(0,0),
> point(3,4) } end)
>
>   local one = module("one", _G, function(_ENV)
>     local x = 1
>     function a() print(x); x=x+1 end
>   end)
>