LlListInsertList

From Second Life Wiki

(Redirected from LSL llListInsertList)
Jump to: navigation, search

Function: list llListInsertList( list dest, list src, integer start );

200 Function ID
0.0 Delay
10.0 Energy

Returns a list that is src inserted into dest at position start.

• list dest
• list src
• integer start


start supports negative indexes.

Specification

Index Positive Negative
First 0 -length
Last length - 1 -1

If start is past the end of dest, then src is appended to dest, it will not add null entries. To avoid this, create empty elements in the list first. A similar outcome occurs when using 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
        }
    }
}
 

See Also

Functions

• llDeleteSubList
• llList2List
• llListReplaceList

Articles

•  Negative Index
Personal tools