Skip to content

ll.ListReplaceList has an off-by-one error in slua #55

@canny

Description

@canny

in slua:


local t = {"a", "b", "c", "d"}

local u = ll.ListReplaceList(t, {"x"}, 2, 2)

print("t", lljson.encode(t)) -- t    ["a","b","c","d"]

print("u", lljson.encode(u)) -- u    ["a","x","b","d"] -- expected ["a","x","c","d"]

lsl is fine:


default { state_entry() {

list t = ["a", "b", "c", "d"];

list u = llListReplaceList(t, ["x"], 1, 1);

llOwnerSay("t: " + llList2Json(JSON_ARRAY, t)); // t: ["a","b","c", "d"]

llOwnerSay("u: " + llList2Json(JSON_ARRAY, u)); // u: ["a","x","c", "d"] // correct

}}

llcompat is fine:


local t = {"a", "b", "c", "d"}

local u = llcompat.ListReplaceList(t, {"x"}, 1, 1)

print("t", lljson.encode(t)) --  t    ["a","b","c", "d"]

print("u", lljson.encode(u)) -- u    ["a","x","c", "d"]

https://secondlife.canny.io/admin/feedback/slua-alpha/p/lllistreplacelist-has-an-off-by-one-error-in-slua

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions