[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Size of a non numerical indexed table
- From: Mike Pall <mikelu-0509@...>
- Date: Thu, 1 Sep 2005 17:09:53 +0200
Lisa Parratt wrote:
> Surely if table.foreach no longer iterates over *each* element in a
> table in all instances, it should no longer be called foreach?
As Wim already pointed out this cannot happen with table.foreach().
You are talking about table.foreachi() which is only defined
for compact tables (*).
And since table.foreachi() ultimately uses the same mechanism
as table.getn(), the results for non-compact tables have changed
with 51w6 of course.
Morale of the story: don't use any of these with non-compact tables:
getn() [Just noticed: why is this still there?]
(*) A compact table is defined as a table where the relationship
t[i] ~= nil or t[i+1] == nil
holds for all positive integers i.
More colloquially this is a table that 'has no holes'.