mirror of
https://github.com/ciribob/DCS-CTLD.git
synced 2025-08-15 06:17:22 +00:00
ctld.getNearbyUnits : sort by distance
This commit is contained in:
parent
e1b9e1d7d8
commit
3eef8d9a5d
2
CTLD.lua
2
CTLD.lua
@ -1989,7 +1989,7 @@ function ctld.getNearbyUnits(_point, _radius, _coalition)
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(unitsByDistance, function(a,b) return a.dist < b.dist end) -- sort the table by distance
|
||||
table.sort(unitsByDistance, function(a,b) return a.dist < b.dist end) -- sort the table by distance (the nearest first)
|
||||
for i, v in ipairs(unitsByDistance) do
|
||||
table.insert(_units, v.unit) -- insert nearby unitName
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user