Page 1 of 1

[2.0.28] Error when setting storage_filter to nil on storage chests

Posted: Sun Jan 12, 2025 12:55 pm
by Daschi
What did you do?
I attempted to clear the storage_filter of a storage chest in my mod by setting the storage_filter property to nil. This was done using the following code:

Code: Select all

script.on_event(prototypes.custom_input["automatic-logistic-chests-refresh-selected-logistic-chest"], function(event)
    local player = game.players[event.player_index]
    local chest = player.selected

    if chest and chest.valid and chest.prototype.logistic_mode == "storage" then
        chest.storage_filter = nil
    end
end)
To reproduce:
1. Hover over a storage chest in-game.
2. Press the shortcut key defined in the mod to trigger the script above.

What happened?
When executing the code, the game produced the following error:

Code: Select all

value for required parameter 1 (item-with-quality-id) is missing
This error occurred regardless of whether the chest currently had a filter set or not.

What did you expect to happen instead?
I expected the storage_filter property to accept nil and clear the filter on the storage chest without causing an error. This expectation aligns with the documentation for the storage_filter property, which indicates it is nullable.

Does it happen always, once, or sometimes?
This issue occurs consistently every time the code is executed.

Additional Context
The storage_filter documentation (https://lua-api.factorio.com/latest/cla ... age_filter) indicates that this property is nullable, and reading the storage_filter property of a chest without a filter correctly returns nil.

Attachments

Re: [2.0.28] Error when setting storage_filter to nil on storage chests

Posted: Mon Jan 13, 2025 12:23 am
by Rseding91
Thanks for the report. This is now fixed for the next release.

Re: [2.0.28] Error when setting storage_filter to nil on storage chests

Posted: Mon Jan 13, 2025 5:08 am
by Daschi
Awesome, thank you for the quick fix!