lua-users home
lua-l archive

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


> Are there any use cases where allowing reading t[nil] or t[nan] is useful?

t[nil] is what happens when you do t[x] and x is nil :-)

This may or not be a programmer error: you may be trying to determine
whether a field given by the user exists in a table. If the user does
not define the name of that field, then it's nil and you get t[nil].
Not too common an idiom, though.