Unit Queries

It’s possible to do database style queries of units using query.lua:

require "query.lua"

-- grab all solar collectors within a radius of 1000
position = ...
solar_collector_units = query({
    "unit_type" = "corsolar",
    "within" = {
        "position"= position,
        "radius" = 1000
    }
})

The implementation is available in beta here