Difference between revisions of "LSL エラー"

From Second Life Wiki
Jump to navigation Jump to search
(copy from original source.)
 
m (moved LSL Errors/ja to LSL エラー: changing Japanese page names..)
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Multi-lang}}
{{Multi-lang|1=LSL Errors|2=/ja}}
{{LSL Header}}
{{LSL Header/ja}}


==Run-time error messages==
==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"をあなたに伝えるかもしれません。


===Script run-time error: Heap Error===
===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===
===Script run-time error: Lists may not contain lists===


Don't try adding a list into a list.
リスト内にリストを入れることはできません。


===Script run-time error: Math Error===
===Script run-time error: Math Error===


Float divided by zero, integer divided by zero, etc.
Float型の数値を0で割ろうとした、integer型の数値を0で割ろうとした、等。


===Script run-time error: Stack-Heap Collision===
===Script run-time error: Stack-Heap Collision===


The Stack has collided with the Bytecode or the Heap.
スタック領域がバイトコード領域やヒープ領域に衝突した。


Each script runs inside 16 KiB of memory divided out among Bytecode, Stack, and Heap.
それぞれのスクリプトは、16キロバイトに分割されたメモリ内で実行されます。そのメモリはバイトコード領域、スタック領域、ヒープ領域に分割されています。


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.
あなたが長すぎるスクリプトを書いてコンパイルすると、大きすぎるバイトコードが生成され、衝突が発生します。 スクリプトがコンパイルできてセーブに成功したとしても、スクリプトを含んだオブジェクトを rez しようとすると、スクリプトはすぐに、あるいは実行中にクラッシュします。


See [[llGetFreeMemory]].
See {{LSLG/ja|llGetFreeMemory}}.


===Run-time error demo scripts===
===Run-time error demo scripts===


Compile and run examples like these to experience the script run-time errors.
ランタイム・エラーを経験するために、以下の例のコンパイルして実行してください。


<pre>
<lsl>
default
default
{
{
Line 40: Line 40:
     }
     }
}
}
</pre>
</lsl>


<pre>
<lsl>
default
default
{
{
Line 51: Line 51:
     }
     }
}
}
</pre>
</lsl>


<pre>
<lsl>
default
default
{
{
Line 64: Line 64:
     }
     }
}
}
</pre>
</lsl>


<pre>
<lsl>
default
default
{
{
Line 79: Line 79:
     }
     }
}
}
</pre>
</lsl>


==Compile-time error messages==
==Compile-time error messages==


The SL GUI may reject some code that you feel is perfectly clear, printing ERROR at you and then explaining with some further complaint.
The SL GUI はあなたが完璧だと思ったいくつかのコードを拒絶し、いくつかの説明と共にERRORを出力するかもしれません。


===ERROR : Type mismatch===
===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:
vector型やrotation型に値を指定するには、 .x .y .z .s という名の要素を使わなければなりません。一度にlistで指定することはできません。例えば:


<pre>
<lsl>
default
default
{
{
Line 98: Line 98:
     }
     }
}
}
</pre>
</lsl>


===ERROR : Byte code assembly failed -- out of memory===
===ERROR : Byte code assembly failed -- out of memory===


You must make each script reasonably small.
スクリプトは、ほどよく小さく(reasonably small)書かなければなりません。


For example, the compiler says you typed too much script if you cascade too many else-if's:
例えば、あまりにも多くのelse-ifを並べた場合、コンパイラはスクリプトが大きすぎると報告します。
<pre>
<lsl>
demoElseIfCompileError(integer count)
demoElseIfCompileError(integer count)
{
{
Line 129: Line 129:
     }
     }
}
}
</pre>
</lsl>


How much script is too much script can vary astonishingly. For example, the 2007-08 Second Life clients varied as much as 30X, from one to the next. Specifically, the Windows client accepted 22 else-if's and refused 23 else-if's, while Mac OS X was accepting 692 else-if's and refusing 693 else-if's.
どのくらいのスクリプトが大きすぎるスクリプトなのかは、驚くほど変化することがあります。例えば、the 2007-08 Second Life クライアントでは30倍程度に変化しました。具体的には、Windowsクライアントは22個のelse-ifを受け付け、23個のelse-ifを拒絶しましたが、Mac OS Xは692個のelse-ifを受け付け、693個のelse-ifを拒絶しました。


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.
OSによって変化するコンパイラの制限は、コピー制限の手段のように働きます。制限のゆるいコンパイラでコンパイルされたスクリプトを誰でも実行できます。しかし、制限の多いコンパイラしか持たないユーザは、そのソースを変更してもセーブできません。


See [[llGetFreeMemory]], [[llMessageLinked]].
See {{LSLG/ja|llGetFreeMemory}}, {{LSLG/ja|llMessageLinked}}.


===ERROR : Syntax error===
===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.
そして、スクリプトをほどよく小さく書かなければなりません。あまりに大きなスクリプトを書いた場合、コンパイラは"out of memory(メモリあふれ)" "byte code assembly failed(バイトコード生成に失敗)"のような丁寧で明確なエラーではなく、 "syntax" error(構文エラー)だと報告するかもしれません。


For example, the 2007-08 Windows Second Life client complained of a Syntax error if you cascaded too many else-if's. The exact limits enforced can vary astonishingly. For example, the 2007-08 Windows Second Life client sometimes accepted as many as 22 cascaded else-if's, but also sometimes rejected as few as 19 cascaded else-if's, depending on other details of the script.
例えば、2007-08年のWindows版のSecond Lifeクライアントは多くのelse-ifを並べるとSyntax error(構文エラー)を報告します。厳密な制限数は驚くほど変化します。例えば、2007-08年のWindows版のSecond Lifeクライアントは、あるときは22個以上並べたelse-ifを受け入れましたが、あるときはスクリプトの他の詳細な記述によって19個以下に並べたelse-ifを拒絶しました。


Programmers who learned LSL on one compiler may feel that that compiler's limits are reasonable, ''e.g.'', up to five hundred cascaded else-if's in Mac OS X, while programmers trained on another compiler may feel instead that only its significantly different limits are reasonable, ''e.g.'', no more than a dozen cascaded else-if's in Windows.
1つのコンパイラでLSLを学ぶプログラマは、コンパイラの制限は合理的(reasonable)なものだと感じるかもしれません。例えば、Mac OS Xでは500個までのelse-ifを並べることができます。しかし別なコンパイラを使うプログラマはそうではなく、大きく異なる制限値だけが合理的だと感じるかもしれません。例えば、Windowsではelse-ifを並べられるのはせいぜい1ダースだと感じるかもしれません。

Latest revision as of 02:05, 15 April 2010

Run-time error messages

スクリプトは実行中に停止し、以下のようなメッセージと共に"Script run-time error"をあなたに伝えるかもしれません。

Script run-time error: Heap Error

無意味な事をしないでください。例えば、結果を返さないルーチンでリスト型を返さないでください。

Script run-time error: Lists may not contain lists

リスト内にリストを入れることはできません。

Script run-time error: Math Error

Float型の数値を0で割ろうとした、integer型の数値を0で割ろうとした、等。

Script run-time error: Stack-Heap Collision

スタック領域がバイトコード領域やヒープ領域に衝突した。

それぞれのスクリプトは、16キロバイトに分割されたメモリ内で実行されます。そのメモリはバイトコード領域、スタック領域、ヒープ領域に分割されています。

あなたが長すぎるスクリプトを書いてコンパイルすると、大きすぎるバイトコードが生成され、衝突が発生します。 スクリプトがコンパイルできてセーブに成功したとしても、スクリプトを含んだオブジェクトを rez しようとすると、スクリプトはすぐに、あるいは実行中にクラッシュします。

See llGetFreeMemory.

Run-time error demo scripts

ランタイム・エラーを経験するために、以下の例のコンパイルして実行してください。

<lsl> default {

   state_entry()
   {
       llOwnerSay((string) [llOwnerSay("bye")]); // Script run-time error: Heap Error
   }

} </lsl>

<lsl> default {

   state_entry()
   {
       list once = [];
       list twice = [once, once]; // Script run-time error: Lists may not contain lists
   }

} </lsl>

<lsl> default {

   state_entry()
   {
       float one = 1.0;
       float zero = 0.0;
       float quotient = one / zero; // Script run-time error: Math Error
       llOwnerSay((string) quotient);
   }

} </lsl>

<lsl> default {

   state_entry()
   {
       list entries = [0];
       while (TRUE)
       {
           entries += entries; // Script run-time error: Stack-Heap Collision
           llOwnerSay((string) llGetListLength(entries));
       }
   }

} </lsl>

Compile-time error messages

The SL GUI はあなたが完璧だと思ったいくつかのコードを拒絶し、いくつかの説明と共にERRORを出力するかもしれません。

ERROR : Type mismatch

vector型やrotation型に値を指定するには、 .x .y .z .s という名の要素を使わなければなりません。一度にlistで指定することはできません。例えば:

<lsl> default {

   state_entry()
   {
       vector vec = (vector) [1, 2, 3]; // ERROR : Type mismatch
       llOwnerSay((string) vec);
   }

} </lsl>

ERROR : Byte code assembly failed -- out of memory

スクリプトは、ほどよく小さく(reasonably small)書かなければなりません。

例えば、あまりにも多くのelse-ifを並べた場合、コンパイラはスクリプトが大きすぎると報告します。 <lsl> 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 == ...)
   {
       ;
   }

} </lsl>

どのくらいのスクリプトが大きすぎるスクリプトなのかは、驚くほど変化することがあります。例えば、the 2007-08 Second Life クライアントでは30倍程度に変化しました。具体的には、Windowsクライアントは22個のelse-ifを受け付け、23個のelse-ifを拒絶しましたが、Mac OS Xは692個のelse-ifを受け付け、693個のelse-ifを拒絶しました。

OSによって変化するコンパイラの制限は、コピー制限の手段のように働きます。制限のゆるいコンパイラでコンパイルされたスクリプトを誰でも実行できます。しかし、制限の多いコンパイラしか持たないユーザは、そのソースを変更してもセーブできません。

See llGetFreeMemory, llMessageLinked.

ERROR : Syntax error

もちろんあなたはスクリプトやスクリプト内の語をコンパイラが受け入れられるように厳密に記述しなければなりません。

そして、スクリプトをほどよく小さく書かなければなりません。あまりに大きなスクリプトを書いた場合、コンパイラは"out of memory(メモリあふれ)" や "byte code assembly failed(バイトコード生成に失敗)"のような丁寧で明確なエラーではなく、 "syntax" error(構文エラー)だと報告するかもしれません。

例えば、2007-08年のWindows版のSecond Lifeクライアントは多くのelse-ifを並べるとSyntax error(構文エラー)を報告します。厳密な制限数は驚くほど変化します。例えば、2007-08年のWindows版のSecond Lifeクライアントは、あるときは22個以上並べたelse-ifを受け入れましたが、あるときはスクリプトの他の詳細な記述によって19個以下に並べたelse-ifを拒絶しました。

1つのコンパイラでLSLを学ぶプログラマは、コンパイラの制限は合理的(reasonable)なものだと感じるかもしれません。例えば、Mac OS Xでは500個までのelse-ifを並べることができます。しかし別なコンパイラを使うプログラマはそうではなく、大きく異なる制限値だけが合理的だと感じるかもしれません。例えば、Windowsではelse-ifを並べられるのはせいぜい1ダースだと感じるかもしれません。