listItemDelete

From Second Life Wiki
Revision as of 15:19, 22 January 2015 by ObviousAltIsObvious Resident (talk | contribs) (<lsl> tag to <source>)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.

Summary

Function: list ListItemDelete( list mylist, string 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
• string element item to remove from mylist

See also: Lists

Specification

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

Examples

list mylist = ["Red", "Green", "Blue", "Brown"];
list myShortenedList = ListItemDelete(mylist, "Brown");
//myShortenedList is now ["Red", "Green", "Blue"]