Difference between revisions of "Template:LSL Function/list/element"

From Second Life Wiki
Jump to navigation Jump to search
m
m
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{LSL_Function/negative index|true|{{{2|none}}}}}{{#if:
{{LSL Injection Test}}{{LSL_Function/negative index|true|{{{2|none_}}}}}{{#if:
 
{{#vardefine:p_{{{1|none}}}_desc|List containing the element of interest.}}
{{#vardefine:p_{{{1|none}}}_desc|List containing the element of interest.}}
{{#vardefine:p_{{{2|none}}}_desc|Index of the element of interest.}}
 
{{#vardefine:header_footnote|{{#if:{{{4|}}}|{{#if:{{#var:header_footnote}}|{{#var:header_footnote}}<br/>}}
{{#vardefine:p_{{{2|none_}}}_desc|Index of the element of interest.}}
If '''{{{2|none}}}''' describes a location not in '''{{{1|none}}}''' then {{{4|}}} is returned.
 
{{#if:{{{3|}}}|<br/>If the element at the location described by index cannot be typecast to [[{{{3|}}}{{#var:lang}}|{{{3|}}}]] then {{{4|}}} is returned.}}|{{#var:header_footnote}}}}}}
{{#vardefine:header_footnote|{{#if:{{{return|}}}|{{#if:{{#var:header_footnote}}|{{#var:header_footnote}}<br/>}}
}}<includeonly>{{LSLC|List/Read Element{{#var:lang}}}}</includeonly>
If {{LSLP|{{{2|none}}}}} describes a location not in {{LSLP|{{{1|none}}}}} then {{{return|}}} is returned.{{#if:{{{3|}}}|<br/>
{{#if:{{{nc|}}}
|If the type of the element at {{LSLP|{{{2|none}}}}} in {{LSLP|{{{1|none}}}}} is not a [[{{{3|}}}{{#var:lang}}|{{{3|}}}]] then {{{return|}}} is returned. <br/>
Here is a workaround: <code>([[{{{3|}}}{{#var:lang}}|{{{3|}}}]])[[llList2String{{#var:lang}}|llList2String]]({{LSL Param|{{{1|none}}}}}, {{LSL Param|{{{2|none}}}}});</code>
|If the type of the element at {{LSLP|{{{2|none}}}}} in {{LSLP|{{{1|none}}}}} is not a [[{{{3|}}}{{#var:lang}}|{{{3|}}}]] it is [[typecast]] to a [[{{{3|}}}{{#var:lang}}|{{{3|}}}]]. {{#if:{{{nf|}}}||If it cannot be typecast {{{return|}}} is returned.}}}}}}|{{#var:header_footnote}}}}}}
 
}}<includeonly>{{LSLC|List/Read Element{{#var:lang}}}}</includeonly><noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|p_{{{1|none}}}_desc}}
|-
{{VarPair|p_{{{1|none_}}}_desc}}
|-
{{VarPair|header_footnote}}
|-
{{VarPair|spec}}
|-
{{VarPair|constants_nb}}
|-
{{VarPairTable|also_articles}}
|}
</noinclude>

Latest revision as of 20:03, 10 June 2012

#var value
p_none_desc List containing the element of interest.
p_none__desc Index of the element of interest.
header_footnote

none_ 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.
constants_nb
also_articles
•  Negative Index