Difference between revisions of "User:Vegas Silverweb/vsListFindList"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with 'Like ListFindList but tries for match based on implicit cast to string, so works pretty good for everything except vectors and rotations initialized in-place with integers. <lsl...')
 
(No difference)

Latest revision as of 14:57, 21 April 2010

Like ListFindList but tries for match based on implicit cast to string, so works pretty good for everything except vectors and rotations initialized in-place with integers.

<lsl> integer vsListFindList(list haystack,list needle) {

   integer i;
   integer j = llGetListLength(haystack);
   string s = llList2String(needle,0);
   for(i=0;i<j;i++) {
       if(llList2String(haystack,i)==s) return i;
       }
   return -1;
   }

</lsl>