lua-users home
lua-l archive

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


On Dec 30, 2010, at 12:28 AM, steve donovan wrote:

> On Thu, Dec 30, 2010 at 8:26 AM, Mark Hamburg <mark@grubmah.com> wrote:
>> A simpler answer is to provide an array namespace....arrays have an explicit length (stored somewhere) and appropriate metamethods to maintain it.
> 
> It's a question of using the appropriate data structure for the job.
> [1] is a reasonably robust array with bounds-checking, where setting
> nil is prohibited so that no holes can happen. It uses newproxy() to
> make the object so that the table functions cannot be used on it.

Ah. But I would have designed array specifically to allow holes while still having a length value that would satisfy those who want holes in their arrays.

Mark