Discrepancy in (integer *= float); between LSL Mono and LSL Luau
planned
SuzannaLinn Resident
I'm reporting this one because we are looking for all the differences, but I don't think that it has any real use.
// LSL Mono
default { state_entry() {
integer a = 2;
(a *= 2.2);
llOwnerSay((string)a); // --> 4
}}
// LSL Luau
default { state_entry() {
integer a = 2;
(a *= 2.2); // --> Script run-time error : cannot take result of integer *= float
}}
a *= 2.2;
works in both, float f = (a *= 2.2);
errors in both.Log In
SuzannaLinn Resident
This is a different error around the same place.
Now without parentheses (that it would work) but with a global variable:
// LSL Luau
integer a = 2;
default { state_entry() {;
a *= 2.2; // --> Script run-time error: lsl_script:0: attempt to perform arithmetic (mul) on nil and number
}}
H
Harold Linden
marked this post as
planned
H
Harold Linden
Thanks for sending this in!
Ahhhh I see! Yep, we need to block all places where we take the result of
int *= float
, but wrapping it in parens isn't really "taking the result".I suspect we need to fix this in Tailslide, since that's where the
LLExpression::getResultNeeded()
that's used by SLua's LSL compiler lives. I imagine it's doing that calculation _before_ stripping out parens, and doesn't account for them.