lua-users home
lua-l archive

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




2010/12/30 Roberto Ierusalimschy <roberto@inf.puc-rio.br>
> All the trouble people have with the table length function and
> the table library, well over 100 posts by now, come down to one
> thing, and one thing only:
>
>     The functions designed for use on tables without holes
>     don't actually give an error message when applied to
>     tables with holes.

And the reason we have well over 100 posts by now comes down to one
thing only: most people do not read those past 100 posts, or do not
understand what some of them say. So they keep repeating proposals that
are either not implementable in an efficient way (despite claims to the
opposite) or that do not actually solve the problem.

-- Roberto


-- 
local tab = {1,2,3,4,5, [666]=6}

print('table length = ',#tab)
print('table maxn = ',table.maxn(tab))
print('table isvirgin ',table.maxn(tab)==#tab)
--
I don't think that 'virgin' feature should be added, because it already is implemented :)

And about the name for that function, I chuckled whan I saw it ;)
Though it might be better to not name it that way.

Cheers,
--
Łukasz Gruner