Difference between revisions of "ListItemDelete"

From Second Life Wiki
Jump to: navigation, search
m
Line 9: Line 9:
 
<lsl>
 
<lsl>
 
list ListItemDelete(list mylist,string element_old) {
 
list ListItemDelete(list mylist,string element_old) {
 +
    list newlist;
 
     integer placeinlist = llListFindList(mylist, [element_old]);
 
     integer placeinlist = llListFindList(mylist, [element_old]);
     list newlist = llDeleteSubList(mylist, placeinlist, placeinlist);
+
     if (placeinlist != -1) {
 +
        newlist = llDeleteSubList(mylist, placeinlist, placeinlist);
 +
    }
 
     return newlist;
 
     return newlist;
 
}
 
}

Revision as of 15:58, 4 August 2008

Function: list ListItemDelete(list mylist, string element);

Removes one item from a list.

See also: Lists

<lsl> list ListItemDelete(list mylist,string element_old) {

   list newlist;
   integer placeinlist = llListFindList(mylist, [element_old]);
   if (placeinlist != -1) {
       newlist = llDeleteSubList(mylist, placeinlist, placeinlist);
   }
   return newlist;

}

</lsl>

list myShortenedList = ListItemDelete(mylist,"Brown");