Difference between revisions of "Template:LSL Function/negative index/range"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
{{#vardefine:spec|{{#if:{{#var:spec}}|{{#var:spec}}<br/>}} | {{#vardefine:spec|{{#if:{{#var:spec}}|{{#var:spec}}<br/>}} | ||
<div style="float:left"> | |||
{{{!}}{{Prettytable}} | {{{!}}{{Prettytable}} | ||
{{!}}-{{Hl2}} | {{!}}-{{Hl2}} | ||
Line 16: | Line 15: | ||
{{!}} -1 | {{!}} -1 | ||
{{!}}} | {{!}}} | ||
</div> | |||
Mentally first translate any negative indexes into positive indexes | |||
{{{!}} | |||
{{!}} | {{!}} | ||
*If '''{{{1}}}''' <= '''{{{2}}}''' then the range operated on starts at '''{{{1}}}''' and ends at '''{{{2}}}'''. ['''{{{1}}}''', '''{{{2}}}'''] | *If '''{{{1}}}''' <= '''{{{2}}}''' then the range operated on starts at '''{{{1}}}''' and ends at '''{{{2}}}'''. ['''{{{1}}}''', '''{{{2}}}'''] | ||
*If '''{{{1}}}''' | *If '''{{{1}}}''' > '''{{{2}}}''' then the range operated on starts at '''{{{1}}}''' and ends at '''{{{2}}}'''. ['''0''', '''{{{2}}}'''] + ['''{{{1}}}''', '''-1'''] | ||
{{!}}} | |||
See {{LSLGC|Negative_Index#Range Functions|negative indexes}} for more information. | |||
<div style="clear:left"></div> | |||
}}<noinclude>{{#var:spec}}</noinclude> | }}<noinclude>{{#var:spec}}</noinclude> |
Revision as of 17:27, 6 March 2007
Index | Positive | Negative |
---|---|---|
First | 0 | -length |
Last | length - 1 | -1 |
Mentally first translate any negative indexes into positive indexes
|
See negative indexes for more information.