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

LSL Wiki : llList2List

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are
list llList2List(list src, integer start, integer end)

Copy the slice of the list from start to end from the list. start and end are inclusive, so 0, length - 1 would copy the entire list and 0, 0 would capture the first list entry.

Using negative numbers for start and/or end causes the index to count backwards from the length of the list, so 0, -1 would capture the entire list.

If start is larger than end the list returned is the exclusion of the entries, so 6, 4 would give the entire list except for the 5th entry.

list    foo = ["a", "b", "c", "d", "e", "f"];

llList2List(foo, 0, 0); // returns ["a"]
llList2List(foo, 0, 5); // returns ["a", "b", "c", "d", "e", "f"]
llList2List(foo, 2, 5); // returns ["c", "d", "e", "f"]
llList2List(foo, 4, -1); // returns ["e", "f"]
llList2List(foo, 4, 1); // returns ["a", "b", "e", "f"]

If you specify a section "out of bounds" it will simply return what it can, or nothing.

list a =  [1,2,3,4,5,6,7];
list b = llList2List(a,5,10);
llSay(0, llDumpList2String(b,","));
// Object: 6,7
list c = llList2List(a,20,30);
llSay(0, llDumpList2String(c,","));
// Object: 
// (empty list)

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

Q: When did llList2List(["singleton"], 1, -1) start returning ["singleton"] instead of [] ?
A: llList2List has always returned the endpoints, -1 would be the first entry in a single entry list. Use 0x8000 or some other large number for the end point (instead of -1). Or just use llDeleteSubList(["singleton"], 0, 0) instead. --BW

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

Lists | Functions
Comments [Hide comments/form]
Attach a comment to this page: