mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Fix the bug detected in llListReplaceList.
This commit is contained in:
parent
8ea6ae50fd
commit
87b6002b6c
1 changed files with 5 additions and 1 deletions
|
@ -1120,12 +1120,16 @@ def llListReplaceList(lst, elems, start, end):
|
|||
assert isinteger(start)
|
||||
assert isinteger(end)
|
||||
L = len(lst)
|
||||
if start < -L:
|
||||
# llListReplaceList([0,1,2,3],[5],-5,-5) should return [0,1,2,3]
|
||||
# llListReplaceList([0,1,2,3],[5],-5,-4) should return [1,2,3]
|
||||
# llListReplaceList([0,1,2,3],[5],-5,-7) should return []
|
||||
elems = []
|
||||
if (start + L if start < 0 else start) > (end + L if end < 0 else end):
|
||||
# Exclusion range. Appends elems at 'start' i.e. at end :)
|
||||
if end == -1: end += L
|
||||
return lst[end+1:start] + elems
|
||||
if end == -1: end += L
|
||||
# BUG: llListReplaceList([1,2,3,4],[5],-5,-5) should return [1,2,3,4]
|
||||
return lst[:start] + elems + lst[end+1:]
|
||||
|
||||
def llListSort(lst, stride, asc):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue