ReplaceListItem
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
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.