ListItemReplace

From Second Life Wiki
Revision as of 05:48, 13 July 2008 by Chaz Longstaff (talk | contribs) (New page: {{LSL Header}} __NOTOC__ <div id="box"> == Function: list ListItemReplace(list {{LSL Param|mylist}}, string {{LSL Param|element_old}},string {{LSL Param|element_new}} ); ==...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function: list ListItemReplace(list mylist, string element_old,string element_new );

Replaces a single occurrence of something in a list with something else that you specify.

See also: Lists

<lsl> list ListItemReplace(list mylist,string element_old, string element_new) {

   integer placeinlist = llListFindList(mylist, [element_old]);
   list newlist = llListReplaceList(mylist, [element_new], placeinlist, placeinlist);
   return newlist;

} </lsl>


list myupdatedList = ListItemReplace(mylist,"Brown","Blue");