lua-users home
lua-l archive

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


On 21 May 2010 12:31, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> a, b = foo()
> setfenv(a, {x=2})
> b()
>
> Does that print 1 or 2?

Neither: it gives an error: attempt to call global 'b' (a nil value).
If you make a,b local, then it does print 2.

Thanks for that, I didn't even properly recognize the extent the bug I was trying to demonstrate :)

    henk