User:Vegas Silverweb/vsListFindList

From Second Life Wiki
< User:Vegas Silverweb
Revision as of 14:57, 21 April 2010 by Vegas Silverweb (talk | contribs) (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...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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>