[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Extending Lua for multiple light userdata types
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 14 Nov 2012 13:30:41 -0200
> 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}.
>
> 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.
The point is exactly the "float with integer values are converted to
integers" rule. It only holds for table keys. If I do
t = {[1.0] = 1.0}
a, b = next(t)
Then b will be 1.0, but a will be 1 (an integer).
> And if Lua gets an integer subtype, it would be natural to return
> array indexes as integers.
Remember that Lua has no such thing as "array indexes", only table keys.
If you have a set of real numbers, some of those numbers may be subtly
transformed into integers. (More often than not this transformation will
be irrelevant ;)
-- Roberto
- References:
- 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