“LlListFindList”的版本间的差异
(创建页面,内容为“{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}} {{函数详情 |函数名 = Function: integer llListFindList( list src, list test ); |参数=…”) |
(没有差异)
|
2020年8月22日 (六) 02:36的最新版本
| 首页 | 函数 | 事件 | 类型 | 操作符 | 常数 | Flow Control | Script Library | Categorized Library | Tutorials |
| 函数名 |
|---|
| Function: integer llListFindList( list src, list test ); |
| 参数:
list src – what to search in (haystack) list test – what to search for (needle) |
| 返回值:
返回 src 中第一个 test 实例的整数索引。 |
| 注意事项 |
|---|
*执行严格的类型匹配和大小写敏感性。
"1" != 1 "1.0" != 1.0 1 != 1.0 "a822ff2b-ff02-461d-b45d-dcd10a2de0c2" != (key)"a822ff2b-ff02-461d-b45d-dcd10a2de0c2" "Justice" != "justice"
|
| 示例 |
|---|
示例一
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
}
}
}
示例二 //You can also search for two items at once to find a pattern in a list
list avatarsWhoFoundMagicLeaves = ["Fire Centaur","Red Leaf"];
default
{
state_entry()
{
integer index = llListFindList(avatarsWhoFoundMagicLeaves, ["Fire Centaur","Red Leaf"]);
if (index != -1)
{
list output = llList2List(avatarsWhoFoundMagicLeaves, index, index + 1);
llOwnerSay(llDumpList2String(output, ","));
// Object: Fire Centaur, Red Leaf
}
}
}
|
| 相关函数 |
|---|
| llSubStringIndex--在另一个字符串中找一个字符串 |
| 相关事件 |
|---|