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)
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
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