Surface:find_entities_filtered accept table of type/name

Post Reply
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Surface:find_entities_filtered accept table of type/name

Post by Choumiko »

Change find_entities_filtered so that it can be called like

Code: Select all

game.get_surface(1).find_entities_filtered{area = {{-10, -10}, {10, 10}}, name= {"rail-signal", "stone-rock", "rail-chain-signal"}}
-- or even like
game.get_surface(1).find_entities_filtered{area = {{-10, -10}, {10, 10}}, filter= {name={"rail-signal", "stone-rock", "rail-chain-signal"}, type={"tree", "rail", "electric-pole"}}}
Right now you have to search for them one by one, this could yield better performance i guess.
One could use find_entities() and do the filtering in lua. I don't know though at what point this is faster than using filtered search multiple times (probably depends on the number of names/types to search and the entities found?)

Post Reply

Return to “Implemented mod requests”