LlListInsertList
From Second Life Wiki
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Tutorials |
Contents |
Summary
Function: list llListInsertList( list dest, list src, integer start );| 200 | Function ID |
| 0.0 | Delay |
| 10.0 | Energy |
Returns a list that contains all the elements from dest but with the elements from src inserted at position start.
| • list | dest | |||
| • list | src | |||
| • integer | start |
start supports negative indexes.
Examples
list numbers = [3, "three", 2, "two", 1, "one"]; default { state_entry() { llOwnerSay(llDumpList2String(numbers, ",")); // Object: 3,three,2,two,1,one integer index = llListFindList(numbers, [2]); if (index != -1) { numbers = llListInsertList(numbers, [2.5, "two and a half"], index); llOwnerSay(llDumpList2String(numbers, ",")); // Object: 3,three,2.500000,two and a half,2,two,1,one } } }
Notes
Bear in mind that the source list will remain unchanged. Instead, a new list will be produced. So, it's important that you capture this with a variable (unless you are acting directly on the results.)
Tip! To insert something at the start of a list, you can just add the two lists (putting the list with the new item(s) first)
list oldList = ["B", "C", "D"]; list newItem = ["A"]; list newlist = newItem + oldList;
This article wasn't helpful for you? Maybe the related article at the LSL Wiki is able to bring enlightenment.

