Page 1 of 1

[Done] Check if an Enity exists in Control

Posted: Tue Jun 04, 2019 7:49 pm
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

Re: Check if an Enity exists in Control

Posted: Tue Jun 04, 2019 8:04 pm
by Bilka
if game.entity_prototypes[foo] then
see https://lua-api.factorio.com/latest/Lua ... prototypes
end

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

Posted: Tue Jun 04, 2019 9:33 pm
by TheSAguy
Thanks Bilka!