[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Numeric key collision related bug in Lua 5.3
- From: Andrew Starks <andrew.starks@...>
- Date: Tue, 21 Apr 2015 16:00:03 -0500
On Tue, Apr 21, 2015 at 3:55 PM, Andrew Starks <andrew.starks@trms.com> wrote:
> On Tue, Apr 21, 2015 at 3:46 PM, Coda Highland <chighland@gmail.com> wrote:
>> nkey = (1<<63)-333
>> fkey = nkey + 0.0
>> print(fkey == nkey) -> true
>>
>> t = {}
>> t[nkey] = "nkey"
>> t[fkey] = "fkey"
>> print(t[nkey], t[fkey]) -> "fkey" "fkey" -- Expected
>> based on equality check above
>>
>> t[0] = 0
>> print(t[nkey], t[fkey]) -> "fkey" nil -- Unexpected
>
> Thank you for your patience. What am I doing wrong here? I only get
> expected behavior:
>
>> nkey = (1<<63) - 333
>> fkey = nkey + 0.0
>> print(fkey == nkey)
> true
>> t = {[nkey] = 'nkey', [fkey] = 'fkey'}
>> print(t[nkey], t[fkey])
> nkey fkey
>> t[0] = 0
>> print(t[nkey], t[fkey])
> nkey fkey
>> t[nkey] = 'nkey'
>> t[fkey] = 'fkey'
>> print(t[nkey], t[fkey])
> nkey fkey
>> t[0] = 0
>> print(t[nkey], t[fkey])
> nkey fkey
>
> Andrew
ACK
sorry, i only get unexpected behavior. Okay. I'll fade back into the
background now, unless you can point out some other clue that you may
think would be helpful...