Don't click here unless you want to be banned.

LSL Wiki : llListReplaceList

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are
list llListReplaceList(list dest, list src, integer start, integer end)

Returns a list replacing the slice of the list dest from start to end with the list src. start and end are inclusive, so 0, 1 would replace the first two entries and 0, 0 would replace only the first list entry.

Using negative numbers for start and/or end causes the index to count backwards from the length of the list, so 0, -1 would replace the entire list.

If start is larger than end, the list returned is the list between start and end followed by src, so 6, 4 would return the 5th entry with src after that.

Example of Slices:
// (Note that this is not real code.)
list    foo = ["a", "b", "c", "d", "e", "f", "g"];
list    bar = ["0", "1"];
list    zot;
zot = llListReplaceList(foo, bar, 2, 5); // returns ["a", "b", "0", "1", "g"]
zot = llListReplaceList(foo, bar, 4, -1); // returns ["a", "b", "c", "d", "0", "1"]
zot = llListReplaceList(foo, bar, 4, 1); // returns ["c", "d", "0", "1"]

llListReplaceList does not manipulate dest directly. The list returned by this function is the modified version of the dest. See the following example:

Functional Example:
default {
    touch_start(integer total_number) {
        list foo = ["a", "b", "c", "d", "e", "f", "g"];
        list bar = ["0", "1"];
        foo = llListReplaceList(foo, bar, 2, 5); // to really return ["a", "b", "0", "1", "g"]
        // or done with the list hack
        foo = (foo=[]) + llListReplaceList(foo, bar, 2, 5); // to really return ["a", "b", "0", "1", "g"]

To replace a stride in the list:
list UpdateSubListStrided(list src, list stride, integer start, integer stride_len) {
    return llListReplaceList(src, stride, start, start + stride_len - 1);

Question: Does the slice definied by start and end need to be the same length as src?
Answer: No, you can replace a slice with a longer or smaller src.

Question: I don't get it. It's not replacing my list.
Answer: No, llListReplaceList doesn't actually manipulate dest directly, rather it returns a new list containing the results. To manipulate a list directly, you need to do something like the functional example above. Alternatively, you can pass the result to a new list, and keep the original the same.

Compare with llList2List, llList2ListStrided, llListInsertList, llDeleteSubList, llList2Float, llList2Integer, llList2Key, llList2Rot, llList2String and llList2Vector.

This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Lists Jasa SEO Jasa SEO Murah Sepatu Online Toko Sepatu Online Sepatu Sepatu Murah Sepatu Safety Sepatu Futsal Cheapes Hostgator Coupon Link Booking Televisori offerte Notebook Offerte Berita Terkini Internet Marketer Muda Internet Marketer Indonesia Portatile Apple RDAnet Lorks Karikatur Bisnis Modal Kecil Bisnis UKM Berita Terbaru Iklan Baris Jasa SEO Jasa SEO Murah SEO Indonesia Konsultan SEO SEO Belajar SEO Kursus SEO Kursus SEO Murah Jam Tangan Casio Jam Tangan Casio Jam Tangan Murah Jam Tangan Grosir Baju Terbaru Grosir Baju Baju Terbaru Grosir Baju Murah Bisnis Online Belajar SEO Kerupuk Kerupuk kulit Social Bookmark Dofollow Social Bookmark Kumpulan Puisi Kirim Puisi bola hantu Penumbuh Rambut Penumbuh Rambut timbangan WBC Wonogiri Jasa SEO Murah Jasa SEO Jam Tangan Murah
There are 6 comments on this page. [Display comments/form]