Модуль:RecipeUtils: различия между версиями

Материал из Eco - Русская Wiki
Перейти к:навигация, поиск
[досмотренная версия][досмотренная версия]
Новая страница: «local Utils = require('Module:Utils') local p = {} return p»
 
Нет описания правки
Строка 3: Строка 3:
local p = {}
local p = {}


 
function p.ItemCraft(ItemName)
 
    local Recipes = ""
 
    for RecipeName,RecipeData in pairs(RecipesData.recipes) do
 
        for IngredientName,IngredientData in pairs(RecipeData.Ingredients) do
 
            if IngredientName == ItemName then
                if (Recipes == "") then Recipes = Recipes .. RecipeName else Recipes = Recipes .. ", " .. RecipeName end
            end
        end
    end
         
    return Recipes
end


return p
return p

Версия от 09:45, 17 августа 2025

Для документации этого модуля может быть создана страница Модуль:RecipeUtils/doc

local Utils = require('Module:Utils')

local p = {}

function p.ItemCraft(ItemName)
    local Recipes = ""
    for RecipeName,RecipeData in pairs(RecipesData.recipes) do
        for IngredientName,IngredientData in pairs(RecipeData.Ingredients) do
            if IngredientName == ItemName then
                if (Recipes == "") then Recipes = Recipes .. RecipeName else Recipes = Recipes .. ", " .. RecipeName end
            end
        end
    end
           
    return Recipes
end

return p