LlListFindList/ja
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
LSL ポータル | 関数 | イベント | 型 | 演算子 | 定数 | 実行制御 | スクリプトライブラリ | カテゴリ別スクリプトライブラリ | チュートリアル |
要約
関数: integer llListFindList( list src, list test );警告
サンプル
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, ","));
// オブジェクト: 3,4
}
}
}
//2 つの要素をいっぺんに調べ、リストの中のパターンを見つけることもできます。
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, ","));
// オブジェクト: Fire Centaur, Red Leaf
}
}
}
便利なスニペット
ある要素がリストに含まれているかを簡単に調べるには...
if(~llListFindList(myList, (list)item))
{//存在する場合の処理をここに記述。
// ~(-1) == 0 なので、上の条件式で問題ありません。
// != -1 よりもバイトコードの節約となり、動作も速いです。
}
関連項目
関数
• | llSubStringIndex | – | 他の文字列の中で文字列を検索する | |
• | List: Find Last Index | – | 入力文字列でヒットした 最後の インスタンスのインデックスを表す整数値を返す | |
• | List: Multi-Find Index (First_or_Last) | – | 入力文字列でマッチした要素の 全部の 最初 (または最後) のインデックスを取得する |
特記事項
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。