[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: keys in tables
- From: Mark Hamburg <mhamburg@...>
- Date: Sat, 10 Dec 2005 09:23:11 -0800
I have a lot of code that uses tables to map objects to other objects for
things like cached lookup -- e.g., get the FooBarManager for this Whizzle if
one exists. Those are generally at least partially weak tables.
I also use the support for arbitrary keys when building sets of objects.
on 12/10/05 9:00 AM, Gavin Wraith at email@example.com wrote:
> Somebody must have asked this before! Is there anybody
> who can claim to have written a Lua program that uses
> a table whose keys are neither numbers nor strings,
> and for which this feature is essential?
> When I first learned that Lua allowed any non-nil value
> as a key, I thought "Wow - democracy for table-keys".
> That was quite a time ago. But what properties do we actually
> require of keys in a table? 1) that keys are distinguishable,
> and sometimes 2) that keys form a linear order. Can anybody
> suggest any other qualities that might be desirable?