Don't click here unless you want to be banned.

LSL Wiki : llList2ListStrided

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
list llList2ListStrided(list src, integer start, integer end, integer stride)

Copies the strided slice of the list from start to end.

llList2ListStrided returns a list consisting of every stride'th element from src that is between element start and element end.

list src = ["a", 1, 2, "b", 3, 4, "c", 5, 6, "d", 7, 8];

llList2ListStrided(src, 1, 7, 3);

The result is: [ "b", "c" ]

Probably the most useful application would be:
llList2ListStrided(src, 0, -1, 3);

Which gives the result: [ "a", "b", "c", "d" ]

Q & A:


Q: What's a "stride"?
A: See stride.

Q: How do you get a list of the anything but the first items in the stride? I've tried various combinations of parameters and never got quite what I expected. If I want the whole sub-list I'd expect passing 0 as start would give me a list of the first elements, 1 would give the second elements and so forth, but that's not what happens like an offset into the stride.
A: That is not possible with this function - it can only access the first element in a stride. Perhaps it isn't working as it was originally intended, as the more reasonable way for it to work would indeed be to select elements from the stride based on start.
However, there is actually a workaround for this. To produce a list of all the second elements, just chop the first element off the list with llList2List or llDeleteSubList. This effectively causes llList2ListStrided to offset where it counts the start of the stride from.

So, to get every second element...
llList2ListStrided(llDeleteSubList(src, 0, 0), 0, -1, 2));
and to get every third element...
llList2ListStrided(llDeleteSubList(src, 0, 1), 0, -1, 3));

(For more on removing the first element from the stride, see this forum thread.)

Compare with llList2Float, llList2Integer, llList2Key, llList2List, llList2Rot, llList2String and llList2Vector.


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | 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
Comments [Hide comments/form]
This appears to return a list consisting of every stride'th element from src that is between element start and element end.

So:

list src = ["a", 1, 2, "b", 3, 4, "c", 5, 6, "d", 7, 8];

llList2ListStrided(src, 1, 7, 3);

The result is: [ "b", "c" ]

Probably the most useful application would be:

llList2ListStrided(src, 0, -1, 3);

Which gives the result: [ "a", "b", "c", "d" ]

See my comment on the llListSort page for an explanation of "stride".
-- GunzourYellowknife (2004-06-26 23:00:10)
With a list of strings: destinations = ["V1","dest1","V2","dest2","V3","dest3",...,"Vn","destn"]
I want to get a new list of destinations: ["dest1","dest2","dest3",...,"Vn"]

I tried:
destList = llList2ListStrided(destinations, 1, 2n+1, 2);
wich result in: ["V2","V3",...]

And I tried this:
destList = llList2ListStrided(destinations, 0, 2n+1, 2);
wich result in: ["V1","V2","V3",...]

I found this work around:
destList = llList2ListStrided(["0"]+destinations, 2, 1+2n+1, 2);
that makes what I want: ["dest1","dest2","dest3",...,"Vn"]
-- 0x50a1267b.hrnxx5.adsl-dhcp.tele.dk (2007-09-25 12:37:56)
intresting, thanks 4 that one ;) -Tre Giles
-- 64.150.0.1 (2007-10-11 09:01:00)
Here's another interesting use of this. Since the lindens have neglected to provide us with a function that just returns a portion of a list (at least, none are listed on the list main page), you can use this to do just that by defining your start and end, and simply setting the stride to 1.
-- ip68-105-91-192.sd.sd.cox.net (2007-12-03 09:41:12)
Attach a comment to this page: