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

Материал из Space Station 14 Вики
Нет описания правки
Нет описания правки
Строка 20: Строка 20:
     for type, recipes in pairs(p.meals) do
     for type, recipes in pairs(p.meals) do
         for recipeId, recipe in pairs(recipes) do
         for recipeId, recipe in pairs(recipes) do
             if recipeId == id then
             if string(recipeId) == string(id) then
                 out = type
                 out = type
                 break
                 break

Версия от 09:59, 21 октября 2023

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

local prototypes = mw.loadData("Module:Meals Lookup/data")

local p = {}
p.meals = prototypes.meals


function p.getrecipesfromtype(frame) -- {{#invoke:Meals Lookup|getrecipesfromtype|ProtoID}}
    local out = ""

return out
end

function p.buildrecipebox(frame)
    local out = ""
return out
end

function p.getrecipetype(frame, id)
    local out = "nil"
    for type, recipes in pairs(p.meals) do
        for recipeId, recipe in pairs(recipes) do
            if string(recipeId) == string(id) then
                out = type
                break
            end
        end
        if out ~= "nil" then
            break
        end
    end
return out
end

function p.tests(frame)
    local out = ""
    out = p.getrecipetype(frame, frame.arg[1])
return out
end


return p