Модуль:RecipeUtils: различия между версиями
Материал из Eco - Русская Wiki
| [досмотренная версия] | [досмотренная версия] |
StalEF (обсуждение | вклад) Нет описания правки |
StalEF (обсуждение | вклад) Нет описания правки |
||
| Строка 7: | Строка 7: | ||
local Recipes = "" | local Recipes = "" | ||
for RecipeName,RecipeData in pairs(RecipesData.recipes) do | for RecipeName,RecipeData in pairs(RecipesData.recipes) do | ||
for IngredientName,IngredientData in pairs(RecipeData. | for IngredientName,IngredientData in pairs(RecipeData.Products) do | ||
if IngredientName == ItemName then | if IngredientName == ItemName then | ||
if (Recipes == "") then Recipes = Recipes .. RecipeName else Recipes = Recipes .. ", " .. RecipeName end | if (Recipes == "") then Recipes = Recipes .. RecipeName else Recipes = Recipes .. ", " .. RecipeName end | ||
Версия от 10:04, 17 августа 2025
Для документации этого модуля может быть создана страница Модуль:RecipeUtils/doc
local Utils = require('Module:Utils')
local RecipesData = require('Module:RecipeData')
local ItemsData = require('Module:ItemData')
local p = {}
function p.ItemCraft(ItemName)
local Recipes = ""
for RecipeName,RecipeData in pairs(RecipesData.recipes) do
for IngredientName,IngredientData in pairs(RecipeData.Products) do
if IngredientName == ItemName then
if (Recipes == "") then Recipes = Recipes .. RecipeName else Recipes = Recipes .. ", " .. RecipeName end
end
end
end
return Recipes
end
return p