llListFindListNext returns incorrect value for last list element
tracked
Wulfie Reanimator
llListFindListNext(haystack, needle, instance);
Returns the index for the Nth
instance
of needle
. instance
is zero-based.Returns -1 when there aren't enough instances.
Error: Returns
last index + 1
when needle
is the last element of the list.integer index;
list haystack = ["A", "B", "C"];
index = llListFindListNext(haystack, ["C"], 0); // OK
llSay(PUBLIC_CHANNEL, "Expect 2: " + (string)index);
index = llListFindListNext(haystack, ["B"], 1); // OK
llSay(PUBLIC_CHANNEL, "Expect -1: " + (string)index);
index = llListFindListNext(haystack, ["C"], 1);
llSay(PUBLIC_CHANNEL, "Expect -1: " + (string)index);
index = llListFindListNext(haystack, ["C"], 23);
llSay(PUBLIC_CHANNEL, "Expect -1: " + (string)index);
Log In
Maestro Linden
tracked
Maestro Linden
Hi Wulfie, thanks for the helpful report with repro script. Testing on Second Life Server 2025-03-14.13862207703, I see that 3rd and 4th test cases return 3. I agree with your assessment that those test cases should return -1.