list llListSort(list src, integer stride, integer ascending)
into blocks of stride
, in ascending order if ascending
, descending order if ascending
, and returns a new list. src
is not changed. If ascending
is not equal to TRUE
then it is considered FALSE
(not typical in LSL).
Note that llListSort
only works between items of the same type
to either 0 or 1 sorts each item in the list. For any other number, if the length of src
is not a multiple of stride
this function will silently fail.
"strides" are groups of related data. For example, if you are storing information about vegetables, and you want to store the vegetable name, its color, and how many of them you have, you might have a list like this:
list vegetables = ["lettuce", "green", 20, "carrots", "orange", 11, "onions", "yellow", 0];
The stride for this list is 3, because there are 3 pieces of data in a block. llListSort
sorts on the first bit of data in each block, in this case, the vegetable name. This command:
...returns this list:
["carrots", "orange", 11, "lettuce", "green", 20, "onions", "yellow", 0]
are now sorted into alphabetical order.
If data types do not match, llListSort
still returns a modified list, but the results are strange. Note that while the above example uses a list containing both strings and integers, because the stride
is set to 3, llListSort
only sorts the list according to the string containing the name
of the vegetable.
I've been doing a bit of research into this function and here is how it sorts mixed lists. It sorts the list by each type, then it recombines the sorted result by type, so if the first position was a key, then in the output the first position is a key. So...
I am having problems imagining how this could be useful. -- BW
llListSort([3, "a",1,"c", 2, "b"], 1, TRUE) --> [1, "a", 2, "b", 3, "c"]
Ans: This example is using a stride of 1: use a stride of 2 and it will sort the list in a useful way.
Using a stride of 2 in the example above, the result would be:-- KW
llListsort([3, "a", 1, "c", 2, "b"], 2, TRUE) --> [1, "c", 2, "b", 3, "a"]
This article wasn't helpful for you? Maybe the related article at the LSL Portal
is able to bring enlightenment.
| Lists Jasa SEO Jasa SEO Murah Sepatu Online Toko Sepatu Online Sepatu Sepatu Murah Sepatu Safety Sepatu Futsal Cheapes Hostgator Coupon Link Booking Televisori offerte Notebook Offerte Berita Terkini Internet Marketer Muda Internet Marketer Indonesia Portatile Apple RDAnet Lorks Karikatur Bisnis Modal Kecil Bisnis UKM Berita Terbaru Iklan Baris Jasa SEO Jasa SEO Murah SEO Indonesia Konsultan SEO SEO Belajar SEO Kursus SEO Kursus SEO Murah Jam Tangan Casio Jam Tangan Casio Jam Tangan Murah Jam Tangan Grosir Baju Terbaru Grosir Baju Baju Terbaru Grosir Baju Murah Bisnis Online Belajar SEO Kerupuk Kerupuk kulit Social Bookmark Dofollow Social Bookmark Kumpulan Puisi Kirim Puisi bola hantu Penumbuh Rambut Penumbuh Rambut timbangan WBC Wonogiri Jasa SEO Murah Jasa SEO Jam Tangan Murah