Recipe: Fix a bug
This commit is contained in:
		
							parent
							
								
									f8c4b94165
								
							
						
					
					
						commit
						acd86bfe2b
					
				
					 1 changed files with 5 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue