Page 1 of 1

[2.1.9] Cannot create a new filter on deconstruction planner using set_entity_filter

Posted: Sun Jul 05, 2026 12:58 pm
by BurninSun
Some time during 2.0, LuaItem::set_entity_filter (and ::set_tile_filter) were changed such that if the given index doesn't exist, it generates an error "Index out of bounds". The only way to use these 2 functions is to call LuaItem::entity_filters (or ::item_filters) with an entire array of filters, then ::set_entity_filter is able to change a filter at an existing index.

The result is that there is no way to add a new index to a deconstruction planner without using ::entity_filters to write the entire array of existing filters, plus adding any new indexes.

::set_entity_filter (and ::set_tile_filter) should be usable with arbitrary indexes to extend the existing filter count to that index without modifying existing filters.

Code: Select all

/c stack = game.create_inventory(1)[1]
/c stack.set_stack{name="deconstruction-planner", count=1}
/c stack.set_entity_filter(1, "transport-belt")
Results in Error: Index out of bounds

Code: Select all

/c stack.entity_filters = {"pipe"}
/c stack.set_entity_filter(1, "transport-belt")
Works as expected.

Re: [2.1.9] Cannot create a new filter on deconstruction planner using set_entity_filter

Posted: Sun Jul 05, 2026 6:06 pm
by Rseding91
Thanks for the report. This was noticed and fixed internally a few days ago. It will be in the next release.