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

From Second Life Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
{{#vardefine:spec|{{#if:{{#var:spec}}|{{#var:spec}}<br/>}}
{{#if:
<div style="float:left;">
 
{{{!}}{{Prettytable}}
{{#vardefine:spec|{{#var:spec}}{{#if:{{#var:spec}}|<br/>|<span></span>}}
{{{!}} {{Prettytable|style=float:left;}}
{{!}}-{{Hl2}}
{{!}}-{{Hl2}}
! Index
! Index
Line 15: Line 16:
{{!}} -1
{{!}} -1
{{!}}}
{{!}}}
=== Indexes ===
<div style="display:table;">
<div style="display:block;">
*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'''.
</div>
</div>
{{#var:spec_between}}
</div>
<div style="clear:left;"></div>
}}
}}<noinclude>{{#var:spec}}</noinclude>
 
{{#vardefine:caveats|{{#var:caveats}}
* If '''{{{1}}}''' is out of bounds the script continues to execute without an error message.
}}
 
<!--
{{#vardefine:p_{{{1|index}}}_desc|{{{1|start}}} index}}
-->
 
}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|p_{{{1|index}}}_desc}}
|-
{{VarPair|spec}}
|-
{{VarPair|notes}}
|-
{{VarPair|caveats}}
|}
</noinclude>

Revision as of 17:00, 17 April 2009

#var value
p_index_desc
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.
notes
caveats
  • If {{{1}}} is out of bounds the script continues to execute without an error message.