lua-users home
lua-l archive

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


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.

Mark

on 12/10/05 9:00 AM, Gavin Wraith at gavin@wra1th.plus.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?