Difference between revisions of "LSL-Editor/Bugs"

From Second Life Wiki
Jump to navigation Jump to search
(add the Cast of Cast Syntax issue)
m
 
(12 intermediate revisions by 6 users not shown)
Line 1: Line 1:
Here we blog differences found between the Second Life implementation of the Linden Scripting Language (LSL) and the LSL-Editor implementation.
LSL Editor is no longer maintained. Consider LSL Editor Community Edition instead [http://sourceforge.net/projects/lsleditor/ Source Forge: LSL Editor]


Different results seen with a test case are bugs in the implementations or in the specifications. The differences are bugs in the implementations if the specifications say what the implementation should do in the test case, differences are bugs in the specifications if the the specifications don't mention the test case, differences are broken by design if the specification lets the implementation behave indeterminately.
[[LSL_Alternate_Editors|LSL Alternate Editors]] lists a number of alternate worlds that work much like the world shown by the Second Life client, including the world of the binary-code-only [[LSL-Editor]] for Windows in particular.
 
In this article we blog differences found between the Second Life implementation of the Linden Scripting Language (LSL) and the LSL-Editor implementation.
 
Bugs documented here as of 14. Sept. 2007 are reported to LSLEditor's author by --[[User:Huney Jewell|Huney Jewell]] 23:04, 14 September 2007 (PDT)
 
By definition, differences found are merely issues, not definitely bugs, until we understand them. Different results seen with a test case are bugs in the implementations or in the specifications. The differences are bugs in the implementations if the specifications say what the implementation should do in the test case, differences are bugs in the specifications if the the specifications don't mention the test case, differences are broken by design if the specification lets the implementation behave indeterminately.
 
== Combining Rotations ==
 
It looks like LSLEditor doesn't correctly calculated rotations divided by rotations (negative rotations).
 
llRot2Euler(llEuler2Rot(<0,0,0>) / llEuler2Rot(<0,0,PI_BY_TWO>) = <0.00000, -1.57080, 0.00000> in the 2.16 debugger. This is not correct, SL gives the correct answer <0.00000, 0.00000, -1.57080>
 
There seems to be a general issue with the rotation division where the wrong axis is being rotated, Y instead of Z, X instead of Y, Z instead of X. Rotation multiplication (positive rotations) seems OK.


== Cast of Cast Syntax ==
== Cast of Cast Syntax ==


Q1. Are the results I got not the results that everyone gets in world?? Do LSLEditor 2.15 and Second Life 2007-09-12 disagree?
I tested ... offline using LSLEditor 2.15 and got the results I documented ...
 
Q1. ... Do LSLEditor 2.15 and Second Life 2007-09-12 disagree?


A1a. I checked it in-world and yes, i got same results like you.
A1a. I checked it in-world and yes, they do


A1b. I checked again with LSLEditor and they really disagree on these results. And it's not the only difference.
A1b. I checked again with LSLEditor and they really disagree on these results. And it's not the only difference.
Line 13: Line 29:
This term ie. worked correctly in LSLEditor:<br/>
This term ie. worked correctly in LSLEditor:<br/>
<code>float number; <br/>
<code>float number; <br/>
string char = (string)(integer)float;</code> <br/>
string char = (string)(integer)number;</code> <br/>


which didnt compile in-world and needed be changed to<br/>
which didnt compile in-world and needed be changed to<br/>
<code>float number;<br/>
<code>float number;<br/>
string char = (string)((integer)float);</code><br/>
string char = (string)((integer)number);</code><br/>


which in LSLEditor worked correctly, too.
which in LSLEditor worked correctly, too.


-- first posted as chat by [[User:Ppaatt_Lynagh|Ppaatt Lynagh]] and [[User:Huney_Jewell|Huney Jewell]] at [[User_talk:Ppaatt_Lynagh]] in September 2007
-- first posted as chat by [[User:Huney_Jewell|Huney Jewell]] and [[User:Ppaatt_Lynagh|Ppaatt Lynagh]] at [[User_talk:Ppaatt_Lynagh]] in September 2007
 
== [[Separate_Words|Separate Words]] Results Involving [[llParseString2List]] etc. ==
 
I tested Separate Words offline using LSLEditor 2.15 and got the results I documented ...
 
Q1. Are the results I got not the results that everyone gets in world?? Do LSLEditor 2.15 and Second Life 2007-09-12 disagree?
 
A1a. I checked it in-world and yes, ...
 
-- first posted as chat by [[User:Huney_Jewell|Huney Jewell]] and [[User:Ppaatt_Lynagh|Ppaatt Lynagh]] at [[User_talk:Ppaatt_Lynagh]] in September 2007
 
Verified by this test example:
<lsl>
string lf = "\n";
string quote = "\"";
string escape = "\\";
 
list spacers = [quote, "(", ")", "<", ">", "[", "]", "/"];
 
list separators()
{
    string tab = llUnescapeURL("%09"); // != "\t"
    string cr = llUnescapeURL("%0D"); // != "\r"
    return [tab, lf, cr, " ", ",", ";"];
}
 
default
{
    state_entry()
    {
       
        string chars = "42 0.99 \"00000000-0000-0000-0000-000000000000\"
            [abc, def] \"xyz\\\\\"zyx\" <0, 1, 2, 3> // source literals";
        list words = llParseString2List(chars, separators(), spacers);
 
        integer lenWords = llGetListLength(words);
        integer i = 0;
        for (; i < lenWords; ++i)
        {
            llOwnerSay((string) i + ": " + llList2String(words, i));
        }
       
        llOwnerSay("OK");
    }
}</lsl>
In-world test result:
 
<pre>
0: 42
1: 0.99
2: "
3: 00000000-0000-0000-0000-000000000000
4: "
5: [
6: abc
7: def
8: ]
9: "
10: xyz\\
11: "
12: zyx
13: "
14: <
15: 0
16: 1
17: 2
18: 3
19: >
20: /
21: /
22: source
23: literals
OK
</pre>
LSLEditor 2.15 test result:
<pre>
0: 42
1: 0.99
2: 00000000-0000-0000-0000-000000000000
3: abc
4: def
5: xyz\\
6: zyx
7: 0
8: 1
9: 2
10: 3
11: source
12: literals
OK
</pre>
== Use of unassigned local variable ==
Another flaw:
 
This code produces above error msg with LSLEditor 2.16:
 
<lsl>
string msg()
{
float value;
if (TRUE)
value = 1;
else if (FALSE)
value = 0;
return (string)value;
}
 
default
{
state_entry()
{
llOwnerSay(msg());
}
}
</lsl>
 
This runs without error:
 
<lsl>
string msg()
{
float value;
if (TRUE)
value = 1;
else
value = 0;
return (string)value;
}
 
default
{
state_entry()
{
llOwnerSay(msg());
}
}
</lsl>
 
and this is without error, too:
 
<lsl>
string msg()
{
string value;
if (TRUE)
value = "1";
else if (FALSE)
value = "0";
return value;
}
 
default
{
state_entry()
{
llOwnerSay(msg());
}
}
</lsl>
 
-- posted by [[User:Huney_Jewell|Huney Jewell]] in September 2007

Latest revision as of 18:30, 10 January 2018

LSL Editor is no longer maintained. Consider LSL Editor Community Edition instead Source Forge: LSL Editor

LSL Alternate Editors lists a number of alternate worlds that work much like the world shown by the Second Life client, including the world of the binary-code-only LSL-Editor for Windows in particular.

In this article we blog differences found between the Second Life implementation of the Linden Scripting Language (LSL) and the LSL-Editor implementation.

Bugs documented here as of 14. Sept. 2007 are reported to LSLEditor's author by --Huney Jewell 23:04, 14 September 2007 (PDT)

By definition, differences found are merely issues, not definitely bugs, until we understand them. Different results seen with a test case are bugs in the implementations or in the specifications. The differences are bugs in the implementations if the specifications say what the implementation should do in the test case, differences are bugs in the specifications if the the specifications don't mention the test case, differences are broken by design if the specification lets the implementation behave indeterminately.

Combining Rotations

It looks like LSLEditor doesn't correctly calculated rotations divided by rotations (negative rotations).

llRot2Euler(llEuler2Rot(<0,0,0>) / llEuler2Rot(<0,0,PI_BY_TWO>) = <0.00000, -1.57080, 0.00000> in the 2.16 debugger. This is not correct, SL gives the correct answer <0.00000, 0.00000, -1.57080>

There seems to be a general issue with the rotation division where the wrong axis is being rotated, Y instead of Z, X instead of Y, Z instead of X. Rotation multiplication (positive rotations) seems OK.

Cast of Cast Syntax

I tested ... offline using LSLEditor 2.15 and got the results I documented ...

Q1. ... Do LSLEditor 2.15 and Second Life 2007-09-12 disagree?

A1a. I checked it in-world and yes, they do

A1b. I checked again with LSLEditor and they really disagree on these results. And it's not the only difference.

This term ie. worked correctly in LSLEditor:
float number;
string char = (string)(integer)number;

which didnt compile in-world and needed be changed to
float number;
string char = (string)((integer)number);

which in LSLEditor worked correctly, too.

-- first posted as chat by Huney Jewell and Ppaatt Lynagh at User_talk:Ppaatt_Lynagh in September 2007

Separate Words Results Involving llParseString2List etc.

I tested Separate Words offline using LSLEditor 2.15 and got the results I documented ...

Q1. Are the results I got not the results that everyone gets in world?? Do LSLEditor 2.15 and Second Life 2007-09-12 disagree?

A1a. I checked it in-world and yes, ...

-- first posted as chat by Huney Jewell and Ppaatt Lynagh at User_talk:Ppaatt_Lynagh in September 2007

Verified by this test example: <lsl> string lf = "\n"; string quote = "\""; string escape = "\\";

list spacers = [quote, "(", ")", "<", ">", "[", "]", "/"];

list separators() {

   string tab = llUnescapeURL("%09"); // != "\t"
   string cr = llUnescapeURL("%0D"); // != "\r"
   return [tab, lf, cr, " ", ",", ";"];

}

default {

   state_entry()
   {
       
       string chars = "42 0.99 \"00000000-0000-0000-0000-000000000000\" 
           [abc, def] \"xyz\\\\\"zyx\" <0, 1, 2, 3> // source literals";
       list words = llParseString2List(chars, separators(), spacers);
       integer lenWords = llGetListLength(words);
       integer i = 0;
       for (; i < lenWords; ++i)
       {
           llOwnerSay((string) i + ": " + llList2String(words, i));
       }
       
       llOwnerSay("OK");
   }

}</lsl> In-world test result:

0: 42
1: 0.99
2: "
3: 00000000-0000-0000-0000-000000000000
4: "
5: [
6: abc
7: def
8: ]
9: "
10: xyz\\
11: "
12: zyx
13: "
14: <
15: 0
16: 1
17: 2
18: 3
19: >
20: /
21: /
22: source
23: literals
OK

LSLEditor 2.15 test result:

0: 42
1: 0.99
2: 00000000-0000-0000-0000-000000000000
3: abc
4: def
5: xyz\\
6: zyx
7: 0
8: 1
9: 2
10: 3
11: source
12: literals
OK

Use of unassigned local variable

Another flaw:

This code produces above error msg with LSLEditor 2.16:

<lsl> string msg() { float value; if (TRUE) value = 1; else if (FALSE) value = 0; return (string)value; }

default { state_entry() { llOwnerSay(msg()); } } </lsl>

This runs without error:

<lsl> string msg() { float value; if (TRUE) value = 1; else value = 0; return (string)value; }

default { state_entry() { llOwnerSay(msg()); } } </lsl>

and this is without error, too:

<lsl> string msg() { string value; if (TRUE) value = "1"; else if (FALSE) value = "0"; return value; }

default { state_entry() { llOwnerSay(msg()); } } </lsl>

-- posted by Huney Jewell in September 2007