[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug with upvalue multi-assignment (corner case - Lua 5.x)
- From: Florian Weimer <fw@...>
- Date: Thu, 05 Jan 2012 22:24:09 +0100
* Ashwin Hirschi:
>> local a = {};
>> a[1] = (function() a = nil end)()
>>
>> Crashes with error: assignment to nil.
>
> Although not directly related to the topic at hand...
>
> I think it's worthwhile to distinguish between throwing errors
> (handling things gracefully) and crashing (not so gracefully... ;-)).
>
> In this case, Lua doesn't crash, it throws an error.
Not even that, it produces the new value of the variable, which is nil
in this example. As long as Lua does not pull values out of thin air,
this is rather benign.