[英]Logical operators in the filter option
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'... 因为我的过滤器仅考虑参数'source1'...
Just make sure you add the comparison in the second part as well object.id != source2
只要确保您在第二部分中也添加了比较,那么object.id != source2
var source3 = Game.spawns.Spawn1.pos.findClosest(Game.SOURCES_ACTIVE, {
filter: function(object) {
return object.id != source1 && object.id != source2;
}
}).id;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.