OsListSortInPlace
From OpenSimulator
Line 7: | Line 7: | ||
* src: the list to sort | * src: the list to sort | ||
* stride: the list stride. | * stride: the list stride. | ||
− | * ascending: it it is 1, 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> |
- Does nothing if the list length is not a multiple of stride.<br> | - Does nothing if the list length is not a multiple of stride.<br> | ||
- The sort considers the elements that are at indexes that are multiple of stride. The other elements between those multiples are just copied around.<br> | - The sort considers the elements that are at indexes that are multiple of stride. The other elements between those multiples are just copied around.<br> | ||
Line 24: | Line 24: | ||
list src = [1,"D",-4,"A","B"]; | list src = [1,"D",-4,"A","B"]; | ||
llSay(0, "original list: " + llDumpList2String(src,",")); | llSay(0, "original list: " + llDumpList2String(src,",")); | ||
− | osListSortInPlace(src, 1, | + | osListSortInPlace(src, 1, TRUE); |
llSay(0, "sorted in ascending order with stride 1: " + llDumpList2String(src,",")); | llSay(0, "sorted in ascending order with stride 1: " + llDumpList2String(src,",")); | ||
} | } |
Revision as of 17:09, 1 June 2021
osListSortInPlace(list src, integer stride, integer ascending)
| |
Identical to llListSort but does the sort on the original list, so using less memory.
- Does nothing if the list length is not a multiple of stride. | |
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, "osListSortInPlace example"); list src = [1,"D",-4,"A","B"]; llSay(0, "original list: " + llDumpList2String(src,",")); osListSortInPlace(src, 1, TRUE); llSay(0, "sorted in ascending order with stride 1: " + llDumpList2String(src,",")); } } | |
Notes | |
This function was added in 0.9.2 |