lua-users home
lua-l archive

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


No, this is not like _javascript_! 'undef' is NOT a value.

Well semantically it is, but it's a great change nonetheless!

Finally 'nil' became a first class citizen.

't[ i ] = undef' is semantically equal to JS 'delete t[ i ];'

"undefined" in _javascript_ better corresponds to "nil" in Lua, and "null" in JS is a completely nonsense singleton best just never used.

I was recently biten by current behaviour, because of a list being shorter than intended due to a spelling mistake in the last entry, evaluated to nil and no way in the callee of checking it was nil by accident.

Now after all the years Lua greatly improved on this, I feel affirmed just having to lean back and wait a little more and a version or two downward we'll also have 0-based indexing by default as option :-)

Kind regards,