LlListFindList
From Second Life Wiki
Second Life Wiki > LSL Portal > Built-in Functions > LlListFindList (Redirected from LSL llListFindList)
| Languages: |
English • Deutsch • Español • ελληνικά • Français • עברית • Italiano • 日本語 • 한국어 • Nederlands • Magyar • Norsk • Dansk • Svenska • Türkçe • Polski • Português • Русский • украї́нська • 中文(简体) • 中文(繁體) |
| Volunteer translated pages are linked in blue, Google translated pages are linked in grey. Learn how to provide volunteer translations. | |
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Tutorials |
Contents |
Summary
Function: integer llListFindList( list src, list test );| 201 | Function ID |
| 0.0 | 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
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 }
This article wasn't helpful for you? Maybe the related article at the LSL Wiki is able to bring enlightenment.

