Finding any entity at an exact location

Place to get help with not working mods / modding interface.
Post Reply
beefex
Manual Inserter
Manual Inserter
Posts: 3
Joined: Thu Jun 21, 2018 4:21 pm
Contact:

Finding any entity at an exact location

Post by beefex »

Hi, I am probably missing something and there is a function for this. I need to find an entity at an exact spot, exactly what LuaSurface.find_entity does. But I need to be able to find any entity, or entity of specific type. Is there a way to do this without having to use LuaSurface.find_entities_filtred?
Thanks
BeefEX

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Finding any entity at an exact location

Post by eradicator »

beefex wrote:Is there a way to do this without having to use LuaSurface.find_entities_filtred?
Why do you need that?

beefex
Manual Inserter
Manual Inserter
Posts: 3
Joined: Thu Jun 21, 2018 4:21 pm
Contact:

Re: Finding any entity at an exact location

Post by beefex »

Because I need to check if there is an object of a type at a certain position. And all I know is the prototype/type name, not the actual entity name.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Finding any entity at an exact location

Post by eradicator »

Code: Select all

LuaSurface.find_entities_filtered{position=your_position,type=your_type}
API Documentation on LuaSurface.find_entities_filtered

beefex
Manual Inserter
Manual Inserter
Posts: 3
Joined: Thu Jun 21, 2018 4:21 pm
Contact:

Re: Finding any entity at an exact location

Post by beefex »

Okay, didn't realize I can use that one to search just one position. Thank you

Post Reply

Return to “Modding help”