lua-users home
lua-l archive

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


On Thu, Feb 25, 2010 at 1:30 PM, Enrico Colombini <erix@erix.it> wrote:
> Roberto Ierusalimschy wrote:
>>
>> There are no hidden details; just follow rules (1) & (2). That is what
>> the compiler will do.
>
> So, always if I understand correctly, a function definition:
>
>  function f() body end
>
> would be the equivalent of:
>
>  _ENV.f = function() body end
>
> in which case, wouldn't setting _ENV = nil (to forbid assignment to globals)
> also prevent the definition of functions?

Of global functions, yes I suspect, which is the intent of setting
_ENV to nil.  If the user wants to create local functions, they are
certainly still able to do that.

- Jim