lua-users home
lua-l archive

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

On 31 Jan 2003, at 22:32, Wim Couwenberg wrote:

> Hi,
> > I can't use foreachi(). For instance, this takes about half a minute to
> > execute here:
> It's not so bad.  What Peter suggested was to use a three-step process:
> first extract the keys from your set in a seperate list, then sort this list
> of keys and finally use this list to index the original set.  In fact, in
> Lua this is pleasantly fast (in my experience.)  The foreachi construction
> that Peter uses iterates _only_ over the existing keys, i.e. exactly one in
> your example!
> Bye,
> Wim

D'oh - I got it now!

I guess it should be fast enough, especially for small sets.

A dedicated solution should be a bit faster (of course...), with bigger
sets especially.

I have good alternatives now, thanks Peter and Wim!

Fábio R. Cecin