Difference between revisions of "LlListFindList"
Jump to navigation
Jump to search
Line 4: | Line 4: | ||
|func_id=201|func_sleep=0.0|func_energy=10.0 | |func_id=201|func_sleep=0.0|func_energy=10.0 | ||
|return_type=integer|p1_type=list|p1_name=src|p2_type=list|p2_name=test | |return_type=integer|p1_type=list|p1_name=src|p2_type=list|p2_name=test | ||
|func_footnote=If '''test''' is not found in '''src''', {{HoverText|-1|negative one, 0x{{LSL_Hex/Write|-1}}}} is returned. | |func_footnote=If '''test''' is not found in '''src''', {{HoverText|-1|negative one, 0x{{LSL_Hex/Write|-1}}}} is returned.<br/> | ||
The index of the first entry in the list is {{HoverText|0|zero}} | |||
|func_desc | |func_desc | ||
|return_text=that is the index of the first instance of '''test''' in '''src'''. | |return_text=that is the index of the first instance of '''test''' in '''src'''. | ||
Line 14: | Line 15: | ||
An easy way to see if an item exists in a list... | An easy way to see if an item exists in a list... | ||
<pre> | <pre> | ||
if(~llListFindList(myList, | if(~llListFindList(myList, (list)item)) | ||
{//it exists | {//it exists | ||
//This works because ~(-1) == 0 | //This works because ~(-1) == 0 | ||
//It saves bytecode and is faster then doing | //It saves bytecode and is faster then doing != -1 | ||
} | } | ||
</pre> | </pre> |
Revision as of 15:54, 5 June 2007
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: integer llListFindList( list src, list test );201 | Function ID |
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.
The index of the first entry in the list is 0
Caveats
Examples
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 |