Page 1 of 1

Surface:find_entities_filtered accept table of type/name

Posted: Sat Oct 10, 2015 11:49 am
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?)