Hello,
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
The problem I suspect is that the code under the MS_ASMTRICK is not correct (llimits.h:204):
this block:
__asm {__asm fld n __asm fistp i}
that is used in:
#define lua_number2unsigned(i,n) \
{__int64 l; __asm {__asm fld n __asm fistp l} i = (unsigned int)l;}
it's not guaranteed to floor a number, it depends on the FPU rounding
mode.