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

РЕЛИИИИИИЗ!!!!
мНет описания правки
Строка 106: Строка 106:
end
end


-- returns recipes which id is matched by pattern
function getrecipesbyname(frame, tabl, str) -- should not be inviked
function getrecipesbyname(frame, tabl, str) -- should not be inviked
     local out = {}
     local out = {}
Строка 119: Строка 120:
end
end


-- same as above, but returns recipes that *does not* match given pattern
function getotherrecipes(frame, tabl, str) -- should not be invoked
function getotherrecipes(frame, tabl, str) -- should not be invoked
     local out = {}
     local out = {}
Строка 449: Строка 451:
     for _, patt in pairs(frame.args) do
     for _, patt in pairs(frame.args) do
         local ids = getrecipesbyname(frame, tablo, patt)
         local ids = getrecipesbyname(frame, tablo, patt)
        out = out .. p.buildrecipeboxuniversal(frame, ids)
    end
    return out
end
-- same as buildnamedrecipes, but instead builds recipes that does not match the pattern
function p.buildotherrecipes(frame) -- {{#invoke:Meals Lookup|buildotherrecipes|[Pattern1 | Pattern2 | Pattern3 | ...]}}
    local out = ""
    local tablo = p.meals
    for _, patt in pairs(frame.args) do
        local ids = getotherrecipes(frame, tablo, patt)
         out = out .. p.buildrecipeboxuniversal(frame, ids)
         out = out .. p.buildrecipeboxuniversal(frame, ids)
     end
     end