lua-users home
lua-l archive

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


On Tue, May 08, 2007 at 12:31:27PM -0500, Javier Guerra Giraldez wrote:
> On Tuesday 08 May 2007, Sam Roberts wrote:
> > Funny, I needed it yesterday. A benchmark script requests a number of
> > objects, and measures time until all objects have been received.
> > Outstanding requests are indexed by an identifier in a table, when the
> > table size (size:=number of pairs) is zero, all have been received, and
> > benchmark result is calculated.
> 
> if you only want to test if a table is empty, just do:
> 
> function isempty(t)
> 	return next(t) == nil
> end

Good idea, I'd forgotten that trick.

Thanks,
Sam