LlListFindList/ko

From Second Life Wiki
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.

설명

함수: integer llListFindList( list src, list test );
201 함수ID
0.0 지연
10.0 에너지

반환되는 값은 src에서 test와 일치하는 첫 번째 실현치(instance)의 색인.

• list src
• list test

만약 srctest가 존재하지 않으면, -1이 반환된다.
목록에서 첫 번째 항목의 색인은 0이다.

주의

  • 유형 일치를 엄밀하게 해야하며 대소문자가 구별되니 주의하여야 한다.

예제

<lsl>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
       }
   }

}</lsl>

유용한 조각

항목이 목록에 존재하는지를 알기 위한 한 가지 간단한 방법... <lsl>if(~llListFindList(myList, (list)item)) {//만약 존재한다면..

   //원리는, ~(-1) == 0 이므로 동작하게 되는 것이다.
   //이런 방식은 바이트코드를 절약하며 != -1보다 실행 속도가 빠르다.

}</lsl>

함께 보기

함수

•  llSubStringIndex 문자열에서 문자열 찾기
이 글이 유용하지 않으세요? LSL Wiki의 관련항목이 도움을 줄 수 있을 지도 모릅니다.