lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 4/22/2013 4:26 AM, [ex] wrote:
I'm using Lua 5.2 as the foundation of my own language (Killa).
Killa has a JavaScript like syntax and hence supports:

      alert(9.9 | 0); // Alerts 9. (x|0) is used a lot in JS to
floor x.

the code in Lua:

      print(bit32.bor(9.9, 0)) -- prints 10, not 9

JavaScript should have fixed this kind of defect, they had ample releases to do so. Non-integers for a bitwise function? This is like texting while driving... :-)

Just use math.floor in Lua.

Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia