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

Материал из Space Station 14 Вики
(initial)
 
Нет описания правки
Строка 24: Строка 24:
                 break
                 break
             end
             end
        end
        if out ~= nil then
            break
         end
         end
     end
     end

Версия от 09:11, 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 (recipeId == id) or (recipe["id"] == id) then
                out = type
                break
            end
        end
    end
return out
end

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


return p