• Do a test on two tables of objects so as to pick only the pair of objects for which the test is true.

    Note that the predicate method is not called strictly for each pair: When considering a pair of objects, if these objects have already been marked as picked, the predicate method won't be called again.

    Cost (Worst case, predicate being always false): Cost(Setting property 'picked' of NbObjList1+NbObjList2 objects to false)

    • Cost(predicate)NbObjList1NbObjList2
    • Cost(Testing NbObjList1+NbObjList2 booleans)
    • Cost(Removing NbObjList1+NbObjList2 objects from all the lists)

    Cost (Best case, predicate being always true): Cost(Setting property 'picked' of NbObjList1+NbObjList2 objects to false)

    • Cost(predicate)*(NbObjList1+NbObjList2)
    • Cost(Testing NbObjList1+NbObjList2 booleans)

    Parameters

    • predicate: ((object1, object2, extraArg) => boolean)

      The predicate function is called with the two objects to compare, and an optional argument extraArg

    • objectsLists1: ObjectsLists

      The first lists of objects

    • objectsLists2: ObjectsLists

      The second lists of objects

    • inverted: boolean

      If inverted == true, only the objects of the first table are filtered.

    • extraArg: any

      (optional) This argument should be used to avoid declaring the predicate as a closure that would be created and destroyed at each call to twoListsTest (potentially multiple time per frame).

    Returns boolean