Page 1 of 1

Please change first parameter of LuaLogisticNetwork.insert(item,members) to (accept?) a SimpleItemStack

Posted: Thu Sep 13, 2018 10:13 pm
by mrudat
Please change first parameter of LuaLogisticNetwork.insert(item,members) to (accept?) a SimpleItemStack

It is currently possible to:

Code: Select all

local function delete_10_iron_plate_from_logistic_network(logistic_network)
    logistic_network.remove_item({ name="iron-plate", count=10 })
end
But it is not possible to do the opposite:

Code: Select all

local function add_10_iron_plate_to_logistic_network(logistic_network)
    logistic_network.insert({ name="iron-plate", count=10 })
end
I asked how I could (efficiently) do what I wanted, and this was suggested:
DaveMcW wrote:
Thu Sep 13, 2018 2:28 pm
An easier way is:

1. chest = surface.create_entity{name = "steel-chest"}
2. chest.insert{SimpleItemStack}
3. logistic_network.insert(chest.get_inventory(1)[1])
4. chest.destroy()

Allowing SimpleItemStack in LuaLogisticNetwork.insert() sounds like a good idea for Modding interface requests.

Re: Please change first parameter of LuaLogisticNetwork.insert(item,members) to (accept?) a SimpleItemStack

Posted: Fri Sep 14, 2018 3:30 am
by Rseding91
It... already works that way?

Re: Please change first parameter of LuaLogisticNetwork.insert(item,members) to (accept?) a SimpleItemStack

Posted: Fri Sep 14, 2018 6:29 am
by eradicator
Rseding91 wrote:
Fri Sep 14, 2018 3:30 am
It... already works that way?
I haven't used that particular part of the API yet, but the documentation states that insert() expects a full LuaItemStack, maybe the doc is outdated?

Re: Please change first parameter of LuaLogisticNetwork.insert(item,members) to (accept?) a SimpleItemStack

Posted: Fri Sep 14, 2018 7:41 am
by Rseding91
The docs are outdated. It's already fixed in 0.17.

Re: Please change first parameter of LuaLogisticNetwork.insert(item,members) to (accept?) a SimpleItemStack

Posted: Fri Sep 14, 2018 8:14 am
by eradicator
Rseding91 wrote:
Fri Sep 14, 2018 7:41 am
The docs are outdated. It's already fixed in 0.17.
Me looks at doc... oh! Is ItemStackSpecification generally used everywhere now? That would be awesome. (Oh, and there's more for player etc., exiting :3)