Code: Select all
entity_data = {{ ["entity"] = entity, ["tag"] = entity_tag},
{ ["entity"] = entity_2, ["tag"] = entity_2_tag}}
new_entities = surface.find_entities(area)
for k1,v1 in pairs(new_entities) do
for k2,v2 in pairs(entity_data) do
if v1 == v2.entity do
some code involving v2.tag
else
code to add v1 to entity_data
end
end
end
My suggestion is then to add a way to tag entities. For example: entity.set_tag(tag) to set a tag and entity.get_tag() return said tag (or nil). Preferable that this tag is mod specific just as global is.