LlListFindList: Difference between revisions

From Second Life Wiki
Jump to navigation Jump to search
m Fix for alphabetical order in Functions list
Strife Onizuka (talk | contribs)
No edit summary
Line 11: Line 11:
|constants
|constants
|examples
|examples
|helpers
|helpers=
An easy way to see if an item exists in a list...
<pre>
if(~llListFindList(myList, [item]))
{//it exists
    //This works because ~(-1) == 0
    //It saves bytecode and is faster then doing == -1
}
</pre>
|also_functions=
|also_functions=
{{LSL DefineRow||[[llSubStringIndex]]|Find a string in another string}}
{{LSL DefineRow||[[llSubStringIndex]]|Find a string in another string}}

Revision as of 08:02, 29 March 2007

Summary

Function: integer llListFindList( list src, list test );
0.0 Forced Delay
10.0 Energy

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.

Caveats

  • Strict type matching is enforced.

Examples

Useful Snippets

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

if(~llListFindList(myList, [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

Signature

function integer llListFindList( list src, list test );