lua-users home
lua-l archive

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


2014-08-12 23:12 GMT+02:00 Tim Hill <drtimhill@gmail.com>:
>
> On Aug 12, 2014, at 1:02 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>
>> 2014-08-12 19:09 GMT+02:00 Tim Hill <drtimhill@gmail.com>:
>>>
>>> On Aug 12, 2014, at 8:48 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>>>
>>> 4. If you compile a function using `load` or `loadstring`, its _ENV is one
>>> of:
>>>  a. An _ENV parameter.
>>>  b. The _ENV specified in the `load`.
>>>  c. An _ENV upvalue.
>>>
>>>
>>> I think it’s always either the distinguished environment (the one stored in
>>> the registry at a well-known key) or the explicit table specified as an
>>> argument to load().
>>
>> It's only the one specified in the registry if that still happens to be
>> the current upvalue called _ENV. And even the one in the registry
>> may not be the one you started with. You can assign something
>> to debug.getregistry[2]; not recommended, though.
>
>
> That’s not my reading of the docs/source, though they are rather
> unclear.

Have you read my code in env.lua, verified that it gives the specified
results, and checked my logic in claiming why it gives those results?

If not, there is not much point in my trying to argue with you.