lua-users home
lua-l archive

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

Duncan Cross wrote:
> the # length operator require that the table be
> "array-like", or they have undefined, inconsistent behaviour.
> -Duncan

I'm not sure saying it has "undefined" behavior is appropriate. Its
behavior is perfectly defined. It is guaranteed that t[#t] will be
non-nil and t[#t+1] will be nil, except in the special case of #t == 0.
Thus, the table {1, nil, 3} has only two possible results of #t: 1 and 3.

Inconsistent, however, I will take.

Matthew P. Del Buono