llListFindList

From Second Life Wiki
Revision as of 05:49, 27 September 2007 by Core Taurog (talk | contribs)
Jump to navigation Jump to search

Summary

Function: integer llListFindList( list src, list test );

Returns an integer that is the index of the first instance of test in src.

• list src
• list test

If test is not found in src, -1 is returned.
The index of the first entry in the list is 0

Caveats

  • Strict type matching is enforced.
All Issues ~ Search JIRA for related Bugs

Examples

list numbers = [1, 2, 3, 4, 5];
default
{
    state_entry()
    {
        integer index = llListFindList(numbers, [3]);
        if (index != -1)
        {
            list three_four = llList2List(numbers, index, index + 1);
            llOwnerSay(llDumpList2String(three_four, ","));
            // Object: 3,4
        }
    }
}

Useful Snippets

An easy way to see if an item exists in a list...

if(~llListFindList(myList, (list)item))
{//it exists
    //This works because ~(-1) == 0
    //It saves bytecode and is faster then doing != -1
}

See Also

Functions

•  llSubStringIndex Find a string in another string

Deep Notes

Search JIRA for related Issues

Signature

function integer llListFindList( list src, list test );