OsListSortInPlaceStrided
From OpenSimulator
(Difference between revisions)
(Created page with "{{osslfunc |function_syntax=osListSortInPlaceStrided(list src, integer stride, integer stride_index, integer ascending) |threat_level=ignored |permissions=true |delay=0 |descr...") |
|||
Line 9: | Line 9: | ||
* stride_index: index of the element to sort by in stride | * stride_index: index of the element to sort by in stride | ||
* ascending: it it is 1 or TRUE, sort in ascending order. If it is any other value, sort in descendent order.<br> | * ascending: it it is 1 or TRUE, sort in ascending order. If it is any other value, sort in descendent order.<br> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|ossl_example=<source lang="lsl"> | |ossl_example=<source lang="lsl"> | ||
Line 22: | Line 16: | ||
state_entry() | state_entry() | ||
{ | { | ||
− | llSay(0, " | + | llSay(0, "osListSortInPlaceStrided example"); |
− | list src = [1,"D",-4,"A","B"]; | + | list src = [1,"D",-4,"A",9,"B"]; |
llSay(0, "original list: " + llDumpList2String(src,",")); | llSay(0, "original list: " + llDumpList2String(src,",")); | ||
− | + | osListSortInPlaceStrided(src, 2, 0, TRUE); | |
− | llSay(0, "sorted in ascending order with stride | + | llSay(0, "sorted in ascending order with stride 2, index 0: " + llDumpList2String(src,",")); |
− | src = [1,"D",-4,"A", | + | src = [1,"D",-4,"A",9,"B"]; |
llSay(0, "original list: " + llDumpList2String(src,",")); | llSay(0, "original list: " + llDumpList2String(src,",")); | ||
− | + | osListSortInPlaceStrided(src, 2, 1, TRUE); | |
− | llSay(0, "sorted in ascending order with stride 2: " + llDumpList2String(src,",")); | + | llSay(0, "sorted in ascending order with stride 2, index 1: " + llDumpList2String(src,",")); |
} | } | ||
} | } |
Latest revision as of 11:48, 26 April 2023
osListSortInPlaceStrided(list src, integer stride, integer stride_index, integer ascending)
| |
Identical to llListSortStrided but does the sort on the original list, so using less memory.
| |
Threat Level | This function does not do a threat level check |
Permissions | Use of this function is always allowed by default |
Extra Delay | 0 seconds |
Example(s) | |
// default { state_entry() { llSay(0, "osListSortInPlaceStrided example"); list src = [1,"D",-4,"A",9,"B"]; llSay(0, "original list: " + llDumpList2String(src,",")); osListSortInPlaceStrided(src, 2, 0, TRUE); llSay(0, "sorted in ascending order with stride 2, index 0: " + llDumpList2String(src,",")); src = [1,"D",-4,"A",9,"B"]; llSay(0, "original list: " + llDumpList2String(src,",")); osListSortInPlaceStrided(src, 2, 1, TRUE); llSay(0, "sorted in ascending order with stride 2, index 1: " + llDumpList2String(src,",")); } } | |
Notes | |
This function was added in 0.9.3 |