There seems to be an issue with the "members" field on the `LogisticGroup` table returned from `LuaForce::get_logistic_group()` though. It is empty despite my test map having ~2.4k combinators that all have a section using a group called "test group". (`#` operator returns 0 and iterating over it with `pairs()` gets no results.)
Snippet of the code I use to work with the new APIs:
Code: Select all
local player = game.get_player(player_index)
local force = player.force
local api_groups = force.get_logistic_groups()
for _, api_group_name in pairs(api_groups) do
local api_group = force.get_logistic_group(api_group_name)
-- local count = 0
-- for _, section in pairs(api_group.members) do
-- log:debug("member ", count, "( ", section.index, ")")
-- count = count + 1
-- end
local count = #api_group.members
table.insert(result, { name = api_group_name, count = count })
end
(With the commented bit I tested with just in case it was an issue with using `#` to get the size of it.)
For more context, I posted about it on Discord and Bilka clarified the "members" field should be the sections and them not being there is likely a bug.