Difference between revisions of "LlListInsertList"

From Second Life Wiki
Jump to navigation Jump to search
Line 19: Line 19:
         // Object: 3,three,2,two,1,one
         // Object: 3,three,2,two,1,one
         integer index = llListFindList(numbers, [2]);
         integer index = llListFindList(numbers, [2]);
         numbers = llListInsertList(numbers, [2.5, "two and a half"], index);
         if (index != -1)
        llOwnerSay(llDumpList2String(numbers, ","));
        {
        // Object: 3,three,2.500000,two and a half,2,two,1,one
            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
        }
     }
     }
}
}

Revision as of 05:44, 27 September 2007

Summary

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

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

Indexes

  • Positive indexes count from the beginning, the first item being indexed as 0, the last as (length - 1).
  • Negative indexes count from the far end, the first item being indexed as -length, the last as -1.

Caveats

  • If start is out of bounds the script continues to execute without an error message.
All Issues ~ Search JIRA for related Bugs

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

Deep Notes

Search JIRA for related Issues

Signature

function list llListInsertList( list dest, list src, integer start );