LSL Wiki Mirror 7-7-7 : llList2List

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::
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.

Example:
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"]

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


Lists | Functions
There is no comment on this page. [Display comments/form]