ll.FindNotecardTextSync() returns length+1 when the text is found more than once
planned
SuzannaLinn Resident
Using a notecard "test" with a line:
Time flies like an arrow; fruit flies like a banana.
-- one "Time":
print(ll.FindNotecardTextSync("test","Time",0,0,{})[3]) -- 4
-- one "banana":
print(ll.FindNotecardTextSync("test","banana",0,0,{})[3]) -- 6
-- two "like":
print(ll.FindNotecardTextSync("test","like",0,0,{})[3]) -- 5
print(ll.FindNotecardTextSync("test","like",0,0,{})[6]) -- 5
-- two "flies":
print(ll.FindNotecardTextSync("test","flies",0,0,{})[3]) -- 6
print(ll.FindNotecardTextSync("test","flies",0,0,{})[6]) -- 6
Could be related to this:
previously to that canny all lengths were returned +1.
Log In
Tapple Gao
It looks to me like argument #3 (start) should also have index-semantics.
ie, this should be the normal way to call it:
ll.FindNotecardTextSync("test","Time",1,0,{})
Tapple Gao
The very similar function ll.LinksetDataFindKeys already has index-semantics:
ll.LinksetDataReset()
ll.LinksetDataWrite("a", "hello")
ll.LinksetDataWrite("b", "there")
print(lljson.encode(ll.LinksetDataFindKeys(".*", 1, 0))) -- ["a", "b"]
print(lljson.encode(ll.LinksetDataFindKeys(".*", 2, 0))) -- ["b"]
print(lljson.encode(ll.LinksetDataFindKeys(".*", 0, 0))) -- passed 0 when a 1-based index was expected
Tapple Gao
PR submitted for this comment: https://github.com/secondlife/lsl-definitions/pull/58
H
Harold Linden
marked this post as
planned
Thanks for the report!
Likely a bug in my custom FindNotecardSync wrapper, I'll have a look.