Factorio.com|Forums|Wiki|Mod Portal|API Docs

# Factorio Runtime Docs Version 2.0.77

# LuaRecipe - Runtime Docs

## Class LuaRecipe

A crafting recipe. Recipes belong to forces (see LuaForce) because some recipes are unlocked by research, and researches are per-force.

## Members

reload() |  | Reload the recipe from the prototype.
Reload the recipe from the prototype.
has_category(category) | → boolean | Checks if recipe has given category
Checks if recipe has given category
name | :: R string | Name of the recipe. [...]
Name of the recipe. [...]
localised_name | :: R LocalisedString | Localised name of the recipe.
Localised name of the recipe.
localised_description | :: R LocalisedString |
prototype | :: R LuaRecipePrototype | The prototype for this recipe.
The prototype for this recipe.
enabled | :: RW boolean | Can the recipe be used?
Can the recipe be used?
category | :: R string | Category of the recipe.
Category of the recipe.
additional_categories | :: R array[string] | Additional categories of this recipe.
Additional categories of this recipe.
ingredients | :: R array[Ingredient] | The ingredients to this recipe.
The ingredients to this recipe.
products | :: R array[Product] | The results/products of this recipe.
The results/products of this recipe.
hidden | :: R boolean | Is the recipe hidden? [...]
Is the recipe hidden? [...]
hidden_from_flow_stats | :: RW boolean | Is the recipe hidden from flow statistics?
Is the recipe hidden from flow statistics?
energy | :: R double | Energy required to execute this recipe. [...]
Energy required to execute this recipe. [...]
order | :: R string | The string used to alphabetically sort these prototypes. [...]
The string used to alphabetically sort these prototypes. [...]
group | :: R LuaGroup | Group of this recipe.
Group of this recipe.
subgroup | :: R LuaGroup | Subgroup of this recipe.
Subgroup of this recipe.
force | :: R LuaForce | The force that owns this recipe.
The force that owns this recipe.
productivity_bonus | :: RW float | The productivity bonus for this recipe.
The productivity bonus for this recipe.
valid | :: R boolean | Is this object valid? [...]
Is this object valid? [...]
object_name | :: R string | The class name of this object. [...]
The class name of this object. [...]

## Methods

### reload()

Reload the recipe from the prototype.

### has_category(category) → boolean

Checks if recipe has given category

#### Parameters

category | :: RecipeCategoryID |

#### Return values

→ boolean | `true` if recipe has this category.

## Attributes

### name :: Read string

Name of the recipe. This can be different than the name of the result items as there could be more recipes to make the same item.

### localised_name :: Read LocalisedString

Localised name of the recipe.

### localised_description :: Read LocalisedString

### prototype :: Read LuaRecipePrototype

The prototype for this recipe.

### enabled :: Read|Write boolean

Can the recipe be used?

### category :: Read string

Category of the recipe.

### additional_categories :: Read array[string]

Additional categories of this recipe.

### ingredients :: Read array[Ingredient]

The ingredients to this recipe.

#### Example

    -- The ingredients of "advanced-oil-processing" would look like this:
    {{type="fluid", name="crude-oil", amount=100}, {type="fluid", name="water", amount=50}}

### products :: Read array[Product]

The results/products of this recipe.

#### Example

    -- The products of "advanced-oil-processing" would look like this:
    {{type="fluid", name="heavy-oil", amount=25}, {type="fluid", name="light-oil", amount=45}, {type="fluid", name="petroleum-gas", amount=55}}

### hidden :: Read boolean

Is the recipe hidden? Hidden recipes don't show up in the crafting menu.

### hidden_from_flow_stats :: Read|Write boolean

Is the recipe hidden from flow statistics?

### energy :: Read double

Energy required to execute this recipe. This directly affects the crafting time: Recipe's energy is exactly its crafting time in seconds, when crafted in an assembling machine with crafting speed exactly equal to one.

### order :: Read string

The string used to alphabetically sort these prototypes. It is a simple string that has no additional semantic meaning.

### group :: Read LuaGroup

Group of this recipe.

### subgroup :: Read LuaGroup

Subgroup of this recipe.

### force :: Read LuaForce

The force that owns this recipe.

### productivity_bonus :: Read|Write float

The productivity bonus for this recipe.

### valid :: Read boolean

Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.

### object_name :: Read string

The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.

Class used in

- LuaEntity::get_recipe()
- LuaForce::recipes
- RecipeID
- on_player_cancelled_crafting
- on_player_crafted_item
- on_pre_player_crafted_item