lua-users home
lua-l archive

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

* 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.