Undefined behavior with find_entities_filtered
Posted: Sat Sep 26, 2020 3:47 pm
Example code:
The code is intended to find a resource that's at the same position as an entity. It works, but the behavior isn't defined in the api:
Stated one way, with only position defined, the last paragraph doesn't describe what 'shall' happen. Stated another way, an area behavior (no area no position, area+position, position+radius) was not given, so I might expect the function to error, or even search the whole map (no defined area behavior -> search whole map) despite a position being given.
It is a bit pedantic, but can a clarification be given as to whether this behavior is reliable?
Code: Select all
local path = self.ent.surface.find_entities_filtered{position=self.ent.position, type="resource", limit=1}
Code: Select all
Find entities of given type or name in a given area.
If no filters (name, type, or force) are given, returns all entities in the search area. If multiple filters are specified, returns only entities matching all given filters.
If no area and no position are given, then the entire surface is searched. If both area and position are specified, returns only entities matching the position. If position and radius are given, returns only entities within that radius of the position.
It is a bit pedantic, but can a clarification be given as to whether this behavior is reliable?