Page 1 of 1

[boskid][1.1.42] LuaItemStack - get_tile_filter issue

Posted: Sat Oct 16, 2021 6:36 pm
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             

Re: LuaItemStack - get_tile_filter issue

Posted: Sun Oct 17, 2021 4:31 pm
by meifray
checked,I think it is a bug,maybe you can post it in bug report?

Re: [boskid] LuaItemStack - get_tile_filter issue

Posted: Sun Oct 17, 2021 5:04 pm
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.

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

Posted: Sun Oct 17, 2021 5:40 pm
by pistols39
nice one. thanks for the explanation and the workaround!