[boskid][1.1.42] LuaItemStack - get_tile_filter issue

This subforum contains all the issues which we already resolved.
pistols39
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Feb 26, 2019 7:39 pm
Contact:

[boskid][1.1.42] LuaItemStack - get_tile_filter issue

Post by pistols39 »

I am calling get_tile_filter on a deconstruction planner item stack and I always get a nil result even if the filter is set or not.

If I call get_entity_filter on the same item stack it works as expected.

I am not sure if I am using get_tile_filter wrong or not.

sample code is below

Code: Select all


local player = game.get_player(1)
local inv = player.get_main_inventory()

for n = 1, #inv do
	itemstack = inv[n] 
        if itemstack.count > 0 then
		if itemstack.name == "deconstruction-planner" then
			for i = 1, 30 do
                 		filter = itemstack.get_entity_filter(i) -- returns expected value
                        	log(filter)
                        	filter = itemstack.get_tile_filter(i) -- always returns nil regardless if filter is set or not 
                       		log(filter)
                       	end
                 end
        end 
 end             
meifray
Long Handed Inserter
Long Handed Inserter
Posts: 61
Joined: Sat May 29, 2021 6:12 pm
Contact:

Re: LuaItemStack - get_tile_filter issue

Post by meifray »

checked,I think it is a bug,maybe you can post it in bug report?
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3016
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [boskid] LuaItemStack - get_tile_filter issue

Post by boskid »

There is a... copy-paste bug here... LuaItemStack::get_tile_filter returns entity filter... (moving out of Modding help to Bug reports)

For a workaround you can ignore the LuaItemStack::get_tile_filter() method and instead use LuaItemStack::tile_filters [r/w] which is not affected.

-- edit:

Thanks for the report. Issue is now fixed for 1.1.43.
pistols39
Burner Inserter
Burner Inserter
Posts: 16
Joined: Tue Feb 26, 2019 7:39 pm
Contact:

Re: [boskid][1.1.42] LuaItemStack - get_tile_filter issue

Post by pistols39 »

nice one. thanks for the explanation and the workaround!
Post Reply

Return to “Resolved Problems and Bugs”