[Done] Check if an Enity exists in Control

Place to get help with not working mods / modding interface.
Post Reply
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

[Done] Check if an Enity exists in Control

Post by TheSAguy »

Hi,

How can I check if an entity exists in Control?
So in Data.lau I can use

Code: Select all

if data.raw.tree["xxx"] then
I'm setting the following:

Code: Select all

local sage_1_tree_name = "bio-"..tree_name.."-1"
But how can I check if "bio-"..tree_name.."-1" actually exists?

Thanks
Last edited by TheSAguy on Tue Jun 04, 2019 9:33 pm, edited 1 time in total.

Bilka
Factorio Staff
Factorio Staff
Posts: 3169
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Check if an Enity exists in Control

Post by Bilka »

if game.entity_prototypes[foo] then
see https://lua-api.factorio.com/latest/Lua ... prototypes
end
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: [Done] Check if an Enity exists in Control

Post by TheSAguy »

Thanks Bilka!

Post Reply

Return to “Modding help”