lua-users home
lua-l archive

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


The manual says "The type table implements associative arrays, that is, arrays that can be indexed not only with numbers, but with any Lua value except nil and NaN."

I believe this would be better worded as "The type table implements associative arrays, that is, arrays that can have as indices not only numbers, but any Lua value except nil and NaN."

The truth is, v=t[nil] and t[nil]=v both are valid Lua code, except the latter errors because *a nil index cannot exist*. More specifically, you cannot *create* a nil index, but you can check for its existence. Same for NaN.

This wording more accurately represents the reference implementation, and I believe this is intended behaviour.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.