Jump to content

[BUG-233243] llListDiff(collection1, collection2)


primerib1
 Share

You are about to reply to a thread that has been inactive for 458 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Yeah so I made another Jira ticket: BUG-233243

 

New function: llListDiff(collection1, collection2)

Function signature:

    list llListDiff(list collection1, list collection2);

Examples:

    list coll1 = ["a", "b", "c", "d"];
    list coll2 = ["a", "b", "c", "e"];
    list coll3 = ["b", "c", "d", "e"];
    list coll4 = ["e", "f", "g", "h"];

    llListDiff(coll1, coll1) => []
    llListDiff(coll1, coll2) => ["d"]
    llListDiff(coll1, coll3) => ["a"]
    llListDiff(coll1, coll4) => ["a", "b", "c", d"]

    // Order of collection2 does not matter
    llListDiff(coll1, ["d", "c", "b"])      => ["a"]
    llListDiff(coll1, ["c", "a", "d", "b"]) => []

    // collection2 can be shorter/longer than collection1
    llListDiff(coll1, ["c", "d"] ) => ["a", "b"]
    llListDiff(coll1, ["c", "d", "e", "f", "g", "h"]) => ["a", "b"]

 

Feel free to pipe up in the linked bug ticket!

  • Like 1
Link to comment
Share on other sites

1 hour ago, Rolig Loon said:

See  https://wiki.secondlife.com/wiki/Category:LSL_List#Extended_List_Operations  .  I have found that set of list functions very useful over the years.

It's not a matter of implementing a workaround. If you check the ticket, you see that I have also a workaround to do it.

It's a matter of making scripts smaller and less heavy. 

The workarounds all does 2 function calls per item in the first collection.

My proposed function makes, well, exactly 1 function call for the whole collection.

And I dunno ... does the LSL Mono compiler do optimizations by pushing the 2nd collection only once into the stack? Because if not, then for each item in collection1, the whole collection2 gets copied into the stack again, and that will definitely make a slow workaround even slower...

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 458 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...