ReplaceListItem

From Second Life Wiki
Revision as of 10:06, 1 May 2007 by Toebu Emmons (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This returns a new list based on the old one, just with the replaced value at index in list src.


list ReplaceListItem(list src, integer index, string value)
{
    list listA = llList2List(src,0,index - 1);
    integer length = llGetListLength(src);
    list listB = llList2List(src,index + 1, length - index + 1);
    return listA + [value] + listB;
}

To use other data types, just change the type of the var value in the function declaration.