lua-users home
lua-l archive

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


> @oxfam.org.pe wrote:

Peter Hill:
> What I'd like to see is tables storing (internally & invisibly) an
> offset to the first non-nil key.

RLake:
> ... but it means that a[k] = nil could take an
> arbitrary amount of time (in order to scan the table to update the
> pointer).

Wim Couwenberg:
> The following would suffice:
>
> 1.  Adjust the index _upward_ when appropriate during a lua_next.
> 2.  Adjust the index _downward_ when setting an earlier field.
>
> In other words, you just keep a sensible lower bound for the first non-nil
> field.  Just another thought...  :-)

Thanks for stating that Wim. It was, in fact, what I had in mind. I had no
intention of altering the performance of assignment, merely to improve the
action of 'next()'.

*cheers*
Peter Hill