Difference between revisions of "Template:LSL Function/negative index"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 65: Line 65:
  |3=either '''{{LSL Param|{{{2}}}}}''', '''{{LSL Param|{{{3}}}}}''' or '''{{LSL Param|{{{4}}}}}''' are
  |3=either '''{{LSL Param|{{{2}}}}}''', '''{{LSL Param|{{{3}}}}}''' or '''{{LSL Param|{{{4}}}}}''' are
  |2=either '''{{LSL Param|{{{2}}}}}''' or '''{{LSL Param|{{{3}}}}}''' are
  |2=either '''{{LSL Param|{{{2}}}}}''' or '''{{LSL Param|{{{3}}}}}''' are
  |1='''{{LSL Param|{{{2}}}}}''' is}} out of bounds the script continues to execute without an error message{{#if:{{{returns|}}}| {{{returns|}}}|.}}
  |1='''{{LSL Param|{{{2}}}}}''' is}} out of bounds {{#if:{{{oob-return|}}}|this function returns {{{oob-return|}}} and}} the script continues to execute without an error message.
}}}}
}}}}



Revision as of 22:19, 9 April 2010

Format: {{LSL Function/negative index|boolean|p1|p2|p3}}
Exclude p1, p2, or p3 if not used.




Debugging

#var value
header_footnote

{{{2}}} supports negative indexes.

spec
Index Positive Negative
First 0 -length
Last length - 1 -1

Indexes

  • Positive indexes count from the beginning, the first item being indexed as 0, the last as (length - 1).
  • Negative indexes count from the far end, the first item being indexed as -length, the last as -1.
caveats
  • If {{{2}}} is out of bounds the script continues to execute without an error message.
notes
constants_nb
also_articles
•  Test
•  Negative Index
footer