I recently encountered a bug where I was passing an empty table ({}) to the name argument of LuaSurface::find_entities_filtered in my mod Drills of Drills.
This had some unexpected, but not incomprehensible, undocumented behavior (though it did take me three versions of the mod to pin down what was happening) where the function ignored the argument entirely, rather than treating it as a list of zero allowed values and finding nothing.
I think this should probably be noted on the array-accepting arguments to save others the headache in the future.
LuaSurface::find_entities_filtered has unexpected interactions with empty table arguments
Re: LuaSurface::find_entities_filtered has unexpected interactions with empty table arguments
Thanks for the note, I added a description to the affected parameters for the next release (1.1.106). Affected by this are:
name, ghost_name, type, ghost_type in find_entities_filtered and count_entities_filtered.
name in find_tiles_filtered and count_tiles_filtered.
Warning: This behaviour will change in 2.0: Then the more expected will happen, where giving an empty array for these field means nothing matches (unless the filter is inverted, of course).
name, ghost_name, type, ghost_type in find_entities_filtered and count_entities_filtered.
name in find_tiles_filtered and count_tiles_filtered.
Warning: This behaviour will change in 2.0: Then the more expected will happen, where giving an empty array for these field means nothing matches (unless the filter is inverted, of course).
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.