Whitespace unexpectedly breaks string-to-vector, string-to-rot typecasts
tracked
Lou Netizen
vector v = (vector)"<1, 1, 1>";
llOwnerSay((string)v);
RESULT:
<1.00000, 1.00000, 1.00000>
vector v = (vector)"<1 , 1 , 1>"; // note the extra space
llOwnerSay((string)v);
RESULT:
<0.00000, 0.00000, 0.00000>
EXPECT:
<1.00000, 1.00000, 1.00000>
NOTE: Similar results with
" <1, 2, 3>"
(leading space); however, "<1, 2, 3> "
(trailing space), "< 1, 2, 3>"
and "<1, 2, 3 >"
work as expected.Same thing happens typecasting rotations with whitespace before a comma.
I can't think of any reason that whitespace character would be significant and invalidate conversion of the initial string to a vector or rotation. One would think the typecast would be fairly liberal about accepting text representations of vectors and rotations.
Log In
Pazako Karu
Is this the same issue that causes llList2Vector to return ZERO_VECTOR if the target item is a string? I've had to (vector)llList2String(myList, myIndex); to get consistent responses for years.
Lou Netizen
Pazako Karu I can only speculate, but I think that has more to do with the data types of particular list entries (you're asking
llList2Vector()
to process something that isn't type vector
) than a typecasting issue. But I agree it would be nice if llList2Vector
and llList2Rot
were smarter about that.Maestro Linden
tracked
Bleuhazenfurfle Resident
Gah. Yes. Please fix this.
I was going to write this one up ages ago, but got distracted by crashy NaN's, that disappeared on the next sim restart.
You can also shove all sorts of stuff after that last term, and it just ignores it — though I don't see that as a problem like that whitespace is.