Difference between revisions of "ListItemDelete"
Jump to navigation
Jump to search
Elfod Nemeth (talk | contribs) m (minor coode example correction) |
|||
Line 17: | Line 17: | ||
|examples=<lsl> | |examples=<lsl> | ||
list mylist = ["Red", "Green", "Blue", "Brown"]; | list mylist = ["Red", "Green", "Blue", "Brown"]; | ||
list myShortenedList = ListItemDelete(mylist, | list myShortenedList = ListItemDelete(mylist, "Brown"); | ||
//myShortenedList is now ["Red", "Green", "Blue"]</lsl> | //myShortenedList is now ["Red", "Green", "Blue"]</lsl> | ||
|helpers | |helpers |
Revision as of 12:05, 2 May 2009
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: list ListItemDelete( list mylist, list element );Returns a list that is a copy of mylist but with the first instance of element removed.
• list | mylist | – | list to remove items from | |
• list | element | – | item to remove from mylist |
See also: Lists
Specification
<lsl>list ListItemDelete(list mylist,string element_old) {
integer placeinlist = llListFindList(mylist, [element_old]); if (placeinlist != -1) return llDeleteSubList(mylist, placeinlist, placeinlist); return mylist;
}</lsl>
Examples
<lsl> list mylist = ["Red", "Green", "Blue", "Brown"]; list myShortenedList = ListItemDelete(mylist, "Brown");
//myShortenedList is now ["Red", "Green", "Blue"]</lsl>