lua-users home
lua-l archive

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


In message <AANLkTikNqtM3VWqR5FqJyNvT5obhe3RYqNjyGLtuGWzS@mail.gmail.com>
you wrote:

> It is not guaranteed to be 0 if t[1] is nil:
>
>  > print(#{nil, 1})
>  2


The business of "holes" seems to founder on the fact that "k is not
a defined key of t" is not equivalent to "t[k] has the value nil".

My thinking was that if t[1] is not defined, then the array part of
t is {} - I had believed that # should depend only on the array
part of a table.

Perhaps nil is being overloaded with too many meanings?
-- 
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/