[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Multiple Questions
- From: Jamie Webb <j@...>
- Date: Fri, 11 Jun 2004 18:46:29 +0100
On Friday 11 June 2004 17:47, Dan East wrote:
> 2) In C it possible to determine the number of elements in a table without
> iterating it.
Nope. Lua itself doesn't know. It's possible (but not a good idea) to dig
around in the internal structures to get the physical table size, which gives
an upper bound, but that's about it.
The only other possibility is to always set values in the table using a
function which can record the size (you can't just use __newindex because
that won't pick up entries being removed). You could make it appear
transparent using a proxy table (search the list), but that has its own
issues.
-- Jamie Webb