lua-users home
lua-l archive

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


Soni They/Them L. <fakedme@gmail.com> wrote:

> It would not. Integer and float are treated separately in the VM, but
> exposed as a single type.
> 
> They're physically distinct TValues.

The numeric for loop is designed to work on the Lua numeric data type, there
isn't a Rational number data type, so how would you update the numeric for
loop to use them... or am I missing something in relation to your example of
"for i=r(1,10), r(10,10), r(1,10) do ... end"?


> The VM already checks if ttisinteger. Floats and ints have the same
> performance. My proposal would make floats slightly slower (one extra
> check), but it'd also fix a major issue with the current implementation
> (an integral part of a lot of exploits out there), while not affecting int
> performance at all.

Out of curiosity, what exploits are you referring to?

Would having the C style expression for loop be helpful in Lua I wonder?

~Paige