Jump/ja

From Second Life Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The correct title of this article is jump/ja. The initial letter is shown capitalized due to technical restrictions.

jump target;

jump target;
• label target 階層ツリーにおいて、jumpを含むスコープ区間内に存在するラベル名。

@target;

• label target ジャンプのターゲットになるべきラベルは、jumpがラベルと同じスコープか、ラベルが存在するよりも内側のスコープに存在する場合のみ、ターゲットとなることが出来ます。

言い換えれば、ターゲットは必ずjumpに対して階層ツリーの上位に存在しなくてはならず、if文の外側から内側に向かってジャンプは出来ません。また、異なる関数間、異なる(離れた)スコープ間、異なるステート間でジャンプする事は出来ません。これらのようなコードを書いた場合、単純にjumpに対応するラベルが見つからないと言うコンパイルエラーを起こすでしょう。

注意点

ひとつのtargetと複数のjumpを使った場合、必ずしも全ての場合でジャンプが実行されるわけではありません。 複数のジャンプのためには、更にtargetが必要となる場合があるでしょう。 これは、長く知られたLSLのバグです。

サンプル

integer a = 5;
jump over;
@in;
a = 6;
@over;
llOwnerSay((string)a);
if(a < 6)
    jump in;
//script will say 5 and then 6

参考情報

キーワード

•  return
•  state