Recipe: Fix a bug

This commit is contained in:
Simon Brodtmann 2025-02-26 19:52:16 +01:00
parent f8c4b94165
commit acd86bfe2b

View file

@ -11,16 +11,15 @@ function Recipe:new(value)
if type(value) == "string" then
name = value
recipe = data.raw.recipe[name]
if not recipe then
log("Recipe not found: " .. name)
return nil
end
elseif type(value) == "table" then
name = value.name
recipe = value
end
if not recipe then
log("Recipe not found: " .. name)
return nil
end
local obj = {
prototype = recipe
}
@ -150,4 +149,4 @@ function Recipe:clone(name)
return Recipe:new(clone)
end
return Recipe
return Recipe