lua-users home
lua-l archive

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


> I'm talking about ALL attempted accesses of undefined variables, including table/array/class elements. I was wondering if addressing this in a major version update of the language has been considered before and if there are reasons for retaining the current behavior.

Lua's take on this is that undefined variables contain nil. That's the
purpose of nil. That's by design, from day one. On the other hand, Lua
provides mechanisms for handling this differently if you wish. It has
done so from day two.

Perhaps you only need getting used to it. After a while, it feels right.
Just try it.

We've all been there before and I now rarely have an undefined variable
bug that is not caught as soon as possible because nil cannot do anything
useful.