De DigiWiki.
default
{
state_entry()
{
list a = ["a", "b", "e", "d"];
// Replace the range starting and ending at index 2 with ["c"] and store it into b
list b = llListReplaceList(a, ["c"], 2, 2);
// Display the change, will say: "a, b, e, d" -> "a, b, c, d"
llOwnerSay("\""+llList2CSV(a) + "\" -> \"" + llList2CSV(b)+"\"");
}
}
default
{
touch_start(integer total_number)
{
list foo = ["1", "2", "3", "4"];
list bar = ["a", "b"];
llSay(0,llList2CSV(llListReplaceList(foo, bar, 0, 0))); // a, b, 2, 3, 4
llSay(0,llList2CSV(llListReplaceList(foo, bar,-1,-1))); // 1, 2, 3, a, b
llSay(0,llList2CSV(llListReplaceList(foo, bar, 0,-1))); // a, b
llSay(0,llList2CSV(llListReplaceList(foo, bar,-1, 0))); // 2, 3, a, b
llSay(0,llList2CSV(llListReplaceList(foo, bar, 6, 6))); // 1, 2, 3, 4, a, b
llSay(0,llList2CSV(llListReplaceList(foo, bar, 2, 1))); // 1, 2, 3, 4, a, b
llSay(0,llList2CSV(llListReplaceList(foo, bar, 1, 2))); // 1, a, b, 4
llSay(0,llList2CSV(llListReplaceList(foo, bar, 3, 1))); // 3, a, b
}
}