[2.0.22] Set filter comparator to 'any quality' (= nil) not possible per lua

Bugs that are actually features.
User avatar
picklock
Fast Inserter
Fast Inserter
Posts: 237
Joined: Sat Nov 09, 2019 6:49 am
Contact:

[2.0.22] Set filter comparator to 'any quality' (= nil) not possible per lua

Post by picklock »

If you want to set the comparator of a filter of an inventory slot to 'any quality', which as far as I understand is achieved with the value 'nil' for the comparator, this is not possible. The comparator value 'nil' is overwritten by Factorio with the comparator string '=' when the code is executed.

Code I tried with:

Code: Select all

local myContent = {
	name = "iron-plate",
	quality = "normal",
	comparator = nil
}
local myPlayer = game.get_player(1)
local myInventory = myPlayer.get_main_inventory()
myInventory.set_filter(1, myContent)
If you copy an ingame set filter via script to another itemslot, then the comparator is transferred correctly.
My Mods: Picklocks Fusion Power | Picklocks Inserter | Picklocks Lithium Polymer Accumulator | Picklocks rocket silo stats | Picklocks Set Inventory Filters | Picklocks QuickBar Import/Export | Picklocks Nauvis Cliff-Explosives
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3453
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.22] Set filter comparator to 'any quality' (= nil) not possible per lua

Post by boskid »

any quality is achieved by not providing quality as it defaults to "any". Skipping comparator does not produce expected result because if comparator is missing it defaults to "=".
User avatar
picklock
Fast Inserter
Fast Inserter
Posts: 237
Joined: Sat Nov 09, 2019 6:49 am
Contact:

Re: [2.0.22] Set filter comparator to 'any quality' (= nil) not possible per lua

Post by picklock »

Hi boskid!

Thank you for the explanation. Then I know how I can proceed to implement it. So from my point of view it's not a bug.
My Mods: Picklocks Fusion Power | Picklocks Inserter | Picklocks Lithium Polymer Accumulator | Picklocks rocket silo stats | Picklocks Set Inventory Filters | Picklocks QuickBar Import/Export | Picklocks Nauvis Cliff-Explosives
Post Reply

Return to “Not a bug”