check recipe exists before adding to

This commit is contained in:
Brevven 2020-09-15 17:12:39 -07:00
parent a4cdc8a947
commit 44965bf3aa

View file

@ -2,7 +2,9 @@ local data_util = {}
--- Add a given quantity of titanium plates to a given recipe --- Add a given quantity of titanium plates to a given recipe
function data_util.add_titanium_ingredient(quantity, recipe) function data_util.add_titanium_ingredient(quantity, recipe)
if recipe ~= nil and recipe.ingredients ~= nil then
table.insert(recipe.ingredients, {"titanium-plate", quantity}) table.insert(recipe.ingredients, {"titanium-plate", quantity})
end
end end
--- Add titanium processing as a prerequisite to a given technology --- Add titanium processing as a prerequisite to a given technology