[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: how to work with tables with holes
- From: Dirk Laurie <dirk.laurie@...>
- Date: Thu, 26 Sep 2013 22:14:05 +0200
2013/9/26 Sean Conner <email@example.com>:
> 1) Don't set an element to nil. Use table.remove() instead.
> 2) Use a sentinel value to mark removal.
> 3) Keep track of both the size and the maximum index.
> In my opintion, the best practice is #1.
If you are using the table as a list (i.e. the exact key does not
matter, but the property "this item comes before that one"
does). Otherwise #2. I agree that 3) is a big-time PITA.