[2.0.57] LuaForce::get_logistic_group() not populating "members"
Posted: Thu Jun 19, 2025 9:03 pm
Testing out the new logistic group APIs added in 2.0.56, but testing on 2.0.57. Many thanks for adding this since it means being able to finally flesh out the remaining bits of my mod!
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:
`count` ends up being 0 while the base game UI shows the expected ~2.4k.
(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.
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.