These forums are CLOSED. Please visit the new forums HERE
Removing duplicates from a list? |
|
Moonshine Herbst
none
Join date: 19 Jun 2004
Posts: 483
|
05-17-2005 15:15
Any good suggestions on the best way to remove duplicate entries from a list?
|
Editorial Hare
Second Life Resident
![]() Join date: 11 Nov 2004
Posts: 116
|
05-17-2005 15:22
Don't let dupes get added in the first place
![]() http://secondlife.com/badgeo/wakka.php?wakka=llListFindList Returns the position (a.k.a index) of the first instance of test in src (or -1 if test isn’t in src). Otherwise just use that function to run through the list and check itself for each entry _____________________
Please see my alternate account disclaimer here
The world tolerates conceit from those who are successful, but not from anybody else. - John Blake |
Catherine Omega
Geometry Ninja
![]() Join date: 10 Jan 2003
Posts: 2,053
|
05-17-2005 19:38
Editorial's right; prevention is the best medicine. Running llListFindList before adding to the list uses fewer resources than removing an entry in a list with llDeleteSubList.
Now, if you're building the list using llCSV2List or something similar, you CAN remove entries by using llListFindList, removing it, then checking to see if where the next entry is, then putting them all back. Another (likely faster) way would be to use llListSort, finding the index, then adding one until the test list didn't match anymore. _____________________
|