[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [Feature Request?] __key
- From: Coda Highland <chighland@...>
- Date: Thu, 14 Jul 2016 10:31:28 -0700
On Thu, Jul 14, 2016 at 10:29 AM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>> To put it simply, it lets you use bigints as table keys as if they
>> were plain lua ints or floats. E.g.
>>
>> local b1 = require("bigint").one
>> local i = 1
>> local f = 1.0
>> local t = {"one"}
>>
>> print(t[b1], t[i], t[f]) --> one one one
>> print(type(b1), math.type(i), math.type(f)) --> userdata integer float
>
> This should be easy to do using a proxy table with an appropriate __index.
>
I think the issue is that's solving things on the wrong side of the
issue -- it makes a single table able to hold arbitrary keys instead
of making a single object able to be used as a key in an arbitrary
table.
/s/ Adam