Difference between revisions of "ReplaceListItem"

From Second Life Wiki
Jump to navigation Jump to search
 
m (No need to go all complicated, just use the built in function)
 
Line 1: Line 1:
{{LSL Header}}
#redirect [[llListReplaceList]]
 
This returns a new list based on the old one, just with the replaced value at index in list src.
 
<pre>
 
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;
}
 
</pre>
 
To use other data types, just change the type of the var value in the function declaration.
 
{{#vardefine:sort|ReplaceListItem}}{{LSLC|Library}}{{LSLC|Examples}}

Latest revision as of 10:21, 1 May 2007

Redirect to: