Difference between revisions of "Jump"

From Second Life Wiki
Jump to navigation Jump to search
m (Keep the language accessible also for not native speakers.)
Line 2: Line 2:
{{#vardefine:name|jump
{{#vardefine:name|jump
}}{{#vardefine:p_jump_target_desc|Name of a label inside the same leg of the scope hierarchy tree
}}{{#vardefine:p_jump_target_desc|Name of a label inside the same leg of the scope hierarchy tree
}}{{#vardefine:p_label_target_desc|A label that can be jumped to, if the jump is in the same scope or child scope. With other words, you can not jump between functions, you cannot jump between scopes, you can not jump between states. You can't even jump two times to the same place from different start points. :( 
}}{{#vardefine:p_label_target_desc|A label that can be jumped to, if the jump is in the same scope or child scope. It isn't possible to jump between scopes (such as between functions or states).
}}{{#vardefine:header_title|jump {{LSL Param|jump_target|target}};
}}{{#vardefine:header_title|jump {{LSL Param|jump_target|target}};
}}{{#vardefine:header_text|{{{!}}
}}{{#vardefine:header_text|{{{!}}
Line 28: Line 28:
}}{{#vardefine:notes|
}}{{#vardefine:notes|
}}{{#vardefine:caveats|
}}{{#vardefine:caveats|
*A target does not work with multiple jumps in all cases.
*If multiple jumps are declared for the same target label within scope, then only the first will function as expected, all others will silently fail.
**For multiple jumps you may need to use additional targets.
*Labels are scoped at the event and function level, meaning that it is not possible to declare duplicate labels within the same event or function, even if the labels are enclosed in different if-statements, loops etc. Attempting this will result in an unhelpful CIL assembly related error.
***This is a long standing LSL bug.
}}{{#vardefine:helpers|
}}{{#vardefine:helpers|
}}{{#vardefine:also_header|<h3>Keywords</h3>
}}{{#vardefine:also_header|<h3>Keywords</h3>

Revision as of 14:45, 9 January 2012

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

jump target;

jump target;
• label target Name of a label inside the same leg of the scope hierarchy tree

@target;

• label target A label that can be jumped to, if the jump is in the same scope or child scope. It isn't possible to jump between scopes (such as between functions or states).

Caveats

  • If multiple jumps are declared for the same target label within scope, then only the first will function as expected, all others will silently fail.
  • Labels are scoped at the event and function level, meaning that it is not possible to declare duplicate labels within the same event or function, even if the labels are enclosed in different if-statements, loops etc. Attempting this will result in an unhelpful CIL assembly related error.

Examples

<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</lsl>

See Also

Keywords

•  return
•  state