[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.3: functional version of // operator?
- From: Miles Bader <miles@...>
- Date: Mon, 08 Jul 2013 18:19:18 +0900
Dirk Laurie <email@example.com> writes:
> <sigh> here we go again ... </sigh>
> If compatibility with 5.2 is that crucial, why insist on writing code
> that in Lua 5.3 will return true integers? Why not just write in Lua
> 5.2 and trust the developers to provide a compatibility option?
The thing that prompted the exploration of this was that "tostring" in
Lua 5.3 returns something different for floats than it does for
integers, even for floats with integer values, and I had some code
that got confused by that. This code uses floor(a/b) to get that
value, and I changed it to use ifloor but along the way, realized that
for some uses it might be nice to directly use "//" for efficiency
reasons (e.g. Roberto's earlier post about changing some code to use
Inhumanity, n. One of the signal and characteristic qualities of humanity.