[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Extending Lua for multiple light userdata types
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 14 Nov 2012 16:39:45 +0200
2012/11/14 Javier Guerra Giraldez <javier@guerrag.com>:
>
> currently next({[1.0]=true}) returns 1.0, but the key is internally
> just '1' (well, it's not a key, but an index on the array part), it's
> converted to integer when entering array code, and back to float when
> returned to Lua code.
>
> if the "float with integer values are converted to integers" is
> conserved, then i'd guess that {[1.0]=true} is exactly the same as
> {1]=true}. And if Lua gets an integer subtype, it would be natural to
> return array indexes as integers.
>
> so, i'd expect next({1]=true}) returns 1 and next({[1.0]=true}) would
> have to be the same, unless it kept the original float key.
We're in for a lot of fun on this list. At the moment the only pathological
case (reported as a bug every so often) is
> a={}; a[-0]=false; a[0]=true; for k,v in pairs(a) do print(k,v) end;
-0 true
I.e. the original key but the new value.
If we have floats and 64-but integers possible at the same time,
analogy dictates that after
> a={}; a[1.0]=false; a[1]=true
there will be a key-value pair (1.0,true). If default print format stays
as it is now, you won't see the difference if you print it, though. Nice.
In the sense "calling for very fine discrimination", that is. :-)
- References:
- Extending Lua for multiple light userdata types, Rena
- Re: Extending Lua for multiple light userdata types, Dirk Laurie
- Re: Extending Lua for multiple light userdata types, Rena
- Re: Extending Lua for multiple light userdata types, Dirk Laurie
- Re: Extending Lua for multiple light userdata types, Rena
- Re: Extending Lua for multiple light userdata types, Coda Highland
- Re: Extending Lua for multiple light userdata types, liam mail
- Re: Extending Lua for multiple light userdata types, Roberto Ierusalimschy
- RE: Extending Lua for multiple light userdata types, Richter, Jörg
- Re: Extending Lua for multiple light userdata types, Roberto Ierusalimschy
- Re: Extending Lua for multiple light userdata types, Roberto Ierusalimschy
- Re: Extending Lua for multiple light userdata types, Javier Guerra Giraldez