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

Материал из Space Station 14 Вики
Нет описания правки
Нет описания правки
Строка 34: Строка 34:
function p.tests(frame)
function p.tests(frame)
     local out = ""
     local out = ""
     out = p.getrecipetype(frame, frame.arg[1])
     out = p.getrecipetype(frame, frame.args[1])
return out
return out
end
end

Версия от 10:00, 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.args[1])
return out
end


return p