[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 11:34:13 -0200
> > > The overall idea is quite simple. There will be two kinds of numbers,
> > > integers and floats.
> >
> > Does this mean that the following program will fail:
> >
> > t = { true }
> > assert( t[1.0] )
>
> No. 1.0 == 1 (although they have differences).
In particular: for table indexing, floats with integer values would
be converted to integers (as Lua already does internally). So,
next({[1.0] = true}) would be 1.0, not 1.
Note that the difference between 1.0 and 1 should be only visible in
corner cases, such as overflows. (Actually, it could be visible in
performance, too; we have to measure that.)
-- Roberto
- 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