Difference between revisions of "Template:LSL Function/negative index"
Jump to navigation
Jump to search
m |
m |
||
Line 8: | Line 8: | ||
{{#vardefine:ni_nc|}} | {{#vardefine:ni_nc|}} | ||
{{#vardefine:ni_p1|number}} | {{#vardefine:ni_p1|number}} | ||
{{#vardefine:ni_p2|p2}} | |||
{{#vardefine:ni_p3|p3}}--> | <!--{{#vardefine:ni_p3|p3}}--> | ||
</noinclude>{{#if: | </noinclude>{{#if: | ||
Line 54: | Line 54: | ||
|2='''{{LSL Param|{{{2}}}}}''' & '''{{LSL Param|{{{3}}}}}''' | |2='''{{LSL Param|{{{2}}}}}''' & '''{{LSL Param|{{{3}}}}}''' | ||
|3='''{{LSL Param|{{{2}}}}}''', '''{{LSL Param|{{{3}}}}}''' & '''{{LSL Param|{{{4}}}}}''' | |3='''{{LSL Param|{{{2}}}}}''', '''{{LSL Param|{{{3}}}}}''' & '''{{LSL Param|{{{4}}}}}''' | ||
}}}} {{#if:{{#var:t}}| support{{#ifexpr:{{#var:ni_c}}>1||s}}| ''do{{#ifexpr:{{#var:ni_c}}>1||es}} not'' support }} {{LSLGC|Negative_Index{{#var:lang}}|negative indexes}}. | }}}} {{#if:{{#var:t}}| support{{#ifexpr:{{#var:ni_c}}>1||s}}| ''do{{#ifexpr:{{#var:ni_c}}>1||es}} not'' support }} {{LSLGC|Negative_Index{{#var:lang}}|negative indexes}}.{{PBR}} | ||
}} | }} | ||
Line 66: | Line 66: | ||
|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 {{#if:{{{oob-return|}}}|this function returns {{{oob-return|}}} and}} the script continues to execute without an error message. | |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. | ||
{{#if:{{#var:t}}|{{#ifexpr:{{#var:ni_c}}>1|* '''{{LSL Param|{{{2}}}}}''' & '''{{LSL Param|{{{3}}}}}''' will form an [[#exclusion_range|exclusion range]] when '''{{LSL Param|{{{2}}}}}''' is passed '''{{LSL Param|{{{3}}}}}''' (Approximately: '''{{LSL Param|{{{2}}}}}''' > '''{{LSL Param|{{{3}}}}}'''). }}}} | |||
}}}} | }}}} | ||
Revision as of 00:07, 5 September 2011
Format:
{{LSL Function/negative index|boolean|p1|p2|p3}}
Exclude p1, p2, or p3 if not used.
Debugging
#var | value | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
header_footnote |
{{{2}}} & {{{3}}} support negative indexes. | ||||||||||
spec |
Indexes
| ||||||||||
caveats |
| ||||||||||
notes |
Ranges & IndexesThe easiest way to explain how ranges work is to make all indexes positive. Negative indexes are just a way of counting from the tail end instead of the beginning, all negative indexes have a corresponding equivalent positive index (assuming they are in range). Positive indexes past length (after the last index), or negative indexes past the beginning (before the first index) are valid and the effects are predictable and reliable: the entries are treated as if they were there but were removed just before output.
See negative indexes for more information. | ||||||||||
constants_nb | |||||||||||
also_articles |
| ||||||||||
footer |