[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: absence of a __hash metamethod
- From: "Patrick Donnelly" <batrick.donnelly@...>
- Date: Wed, 14 Nov 2007 13:19:51 -0700
I'm not saying this is the most efficient way, but here's something you can do:
> hold = {}
> somenewtable = {}
> hold[somenewtable] = true
> hold[tostring(somenewtable)] = somenewtable
> print(tostring(somenewtable))
> print(tostring(somenewtable))
table: 0x807b6a0
Notice tostring on a table produces a unique string identifier for
that table... You can use it as your "hash".
--
-Patrick Donnelly
"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."
-Will Durant