Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:scripting_portal:lsl_errors [2018/11/03 18:21] (current)
Royale Mobian created
Line 1: Line 1:
 +====== LSL Errors ======
 +===== Run-time error messages =====
  
 +A script may stop running, and chat at you the complaint "​Script run-time error",​ followed by another complaint such as:
 +===== Script run-time error: Heap Error =====
 +
 +Don't speak nonsense. For example, don't return a list of one entry that is the result of a routine that returns no result.
 +===== Script run-time error: Lists may not contain lists =====
 +
 +Don't try adding a list into a list.
 +===== Script run-time error: Math Error =====
 +
 +Float divided by zero, integer divided by zero, etc.
 +
 +See Error/Math for functions that can generate this.
 +===== Script run-time error: Stack-Heap Collision =====
 +The Stack has collided with the Bytecode or the Heap. (The script has run out of memory)
 +
 +You can cause collision by compiling too much script, which produces too much Bytecode. The script compiles and saves successfully,​ but when you rez an object containing the script, the script crashes, immediately or while running.
 +
 +See [[wiki:​scripting_portal:​lsl_functions:​llGetFreeMemory|llGetFreeMemory]] and [[wiki:​scripting_portal:​lsl_script_memory|Memory]] for more details.
 +===== Run-time error demo scripts =====
 +
 +Compile and run examples like these to experience the script run-time errors.  ​
 +<code ossl>
 +default
 +{
 +    state_entry()
 +    {
 +        llOwnerSay((string) [llOwnerSay("​bye"​)]);​ // Script run-time error: Heap Error
 +    }
 +}
 +</​code>​
 +<code ossl>
 +default
 +{
 +    state_entry()
 +    {
 +        list once = [];
 +        list twice = [once, once]; // Script run-time error: Lists may not contain lists
 +    }
 +}
 +</​code>​
 +<code ossl>
 +default
 +{
 +    state_entry()
 +    {
 +        float one = 1.0;
 +        float zero = 0.0;
 +        float quotient = one / zero; // Script run-time error: Math Error
 +        llOwnerSay((string) quotient);
 +    }
 +}
 +</​code>​
 +<code ossl>
 +default
 +{
 +    state_entry()
 +    {
 +        list entries = [0];
 +        while (TRUE)
 +        {
 +            entries += entries; // Script run-time error: Stack-Heap Collision
 +            llOwnerSay((string) llGetListLength(entries));​
 +        }
 +    }
 +}
 +</​code>​
 +===== Compile-time error messages =====
 +
 +The Viewer GUI may reject some code that you feel is perfectly clear, printing ERROR at you and then explaining with some further complaint.
 +==== ERROR : Type mismatch ====
 +You must name the .x .y .z .s components of a vector or rotation that you're assigning, you can't assign them all at once from a list, for instance:
 +<code ossl>
 +default
 +{
 +    state_entry()
 +    {
 +        vector vec = (vector) [1, 2, 3]; // ERROR : Type mismatch
 +        llOwnerSay((string) vec);
 +    }
 +}
 +</​code>​
 +==== ERROR : Byte code assembly failed -- out of memory ====
 +
 +You must make each script reasonably small.
 +
 +For example, the compiler says you typed too much script if you cascade too many else-if'​s: ​
 +<code ossl>
 +demoElseIfCompileError(integer count)
 +{
 +    if (count == 0)
 +    {
 +        ;
 +    }
 +    else if (count == 1)
 +    {
 +        ;
 +    }
 +    else if (count == 2)
 +    {
 +        ;
 +    }
 +    ...
 +    ... // ERROR : Byte code assembly failed -- out of memory
 +    ... // or ERROR : Syntax error
 +    ...
 +    else if (count == ...)
 +    {
 +        ;
 +    }
 +}
 +</​code>​
 +
 +Compilation limits that vary by operating system in effect work as a copy-restriction mechanism. Any resident can run the script compiled by the less limited compiler, but residents who have only the more limited compiler cannot save changes to the source.
 +
 +See [[wiki:​scripting_portal:​lsl_functions:​llGetFreeMemory|llGetFreeMemory]],​ [[wiki:​scripting_portal:​lsl_functions:​llMessageLinked|llMessageLinked]]. ​
 +==== ERROR : Syntax error ====
 +
 +You must punctuate the script and spell the words of the script as will please the compiler, of course.
 +
 +Also you must make each script reasonably small. The compiler may astonishingly complain of a "​syntax"​ error rather than politely complaining more specifically of an "out of memory"​ "byte code assembly failed"​ error, when you make a script unreasonably large. ​
QR Code
QR Code wiki:scripting_portal:lsl_errors (generated for current page)