The most annoying thing I found so far was indeed this "number has no integer representation” issue, most notable with string.format.
This project used string.format("%d”, val) in various places, usually to format a percentage value for UI controls without decimal places. While this obviously just worked before (Lua 5.1) the new behavior is a bit annoying. AFAICS the easiest new way would be to change all of these to "%.0f”, ...
While we can certainly live with this, I wonder if such nitpicking details are really worth to have in a higher level language like Lua. Especially as code like this could work fine at a first glance, and randomly error with values not seen during development & testing.
The same can be said about the reverse decision. As I explained (too)
many times before, Lua never defined how numbers are rounded to integers
in the API, so any software that depends on that feature can randomly
error with values not seen during development & testing. Now, at least,
you get a real error message, instead of silent wrong values.
If you really want, you can compile Lua with LUA_FLOORN2I defined to 1;
that makes Lua use floor for such conversions. (You can also define
LUA_FLOORN2I to 2, to get ceil instead…)
OK, thanks for the pointer to that define, I will try floor for some days, and consider patching that to round.
On the plus side native bitwise operation are some 20% faster compared to Lua-5.1 with bitop in some arithmetic heavy code.