Reputation: 13
How to use two arguments in a filter?
var source3 = Game.spawns.Spawn1.pos.findClosest(Game.SOURCES_ACTIVE, {
filter: function(object) {
return object.id != source1 && source2;
}
}).id;
Because my filter only considers the argument 'source1'...
Upvotes: 0
Views: 710
Reputation: 3565
Just make sure you add the comparison in the second part as well object.id != source2
var source3 = Game.spawns.Spawn1.pos.findClosest(Game.SOURCES_ACTIVE, {
filter: function(object) {
return object.id != source1 && object.id != source2;
}
}).id;
Upvotes: 1