Модуль:Meals Lookup: различия между версиями
Mhamster (обсуждение | вклад) non-expensive getimage |
Pok (обсуждение | вклад) мНет описания правки |
||
| (не показано 65 промежуточных версий 5 участников) | |||
| Строка 1: | Строка 1: | ||
local prototypes = mw.loadData("Module:Meals Lookup/data") | local prototypes = mw.loadData("Module:Meals Lookup/data") | ||
local chem = mw.loadData("Module:Chemistry Lookup/data") | local chem = mw.loadData("Module:Chemistry Lookup/data") | ||
local tags = mw.loadData("Module:IanComradeBot/prototypes/entity tags.json/data") | |||
local p = {} | local p = {} | ||
| Строка 7: | Строка 8: | ||
--#region universal | --#region universal | ||
function table.containsv(t, value) -- FUCKING LUA | |||
-- containsv = contains value | |||
for _, v in pairs(t) do | |||
if v == value then | |||
return true | |||
end | |||
end | |||
return false | |||
end | |||
function table.containsk(t, key) -- FUCKING LUA | |||
-- containsk = contains key | |||
for k, _ in pairs(t) do | |||
if k == key then | |||
return true | |||
end | |||
end | |||
return false | |||
end | |||
function table.length(t) | |||
local out = 0 | |||
for _ in pairs(t) do | |||
out = out + 1 | |||
end | |||
return out | |||
end | |||
function table.isempty(t) | |||
local count = table.length(t) | |||
if count == 0 then | |||
do | |||
return true | |||
end | |||
end | |||
return false | |||
end | |||
-- Вспомогательная функция для обрезки пробелов | |||
local function trim(s) | |||
return (s:gsub("^%s*(.-)%s*$", "%1")) | |||
end | |||
-- Функция проверки тегов рецепта по параметрам фильтрации | |||
function p.recipePassesTags(frame, recipe) | |||
local productId = recipe["result"] or recipe["id"] | |||
local productTags = {} | |||
for _, entry in ipairs(tags) do | |||
if entry.id == productId then | |||
if entry.Tag and entry.Tag.tags then | |||
productTags = entry.Tag.tags | |||
end | |||
break | |||
end | |||
end | |||
-- Если заданы белый или чёрный списки, выполняем фильтрацию | |||
if frame.args.whiteListTags then | |||
local whitelist = {} | |||
for tag in string.gmatch(frame.args.whiteListTags, "([^,]+)") do | |||
table.insert(whitelist, trim(tag)) | |||
end | |||
local found = false | |||
for _, wtag in ipairs(whitelist) do | |||
if table.containsv(productTags, wtag) then | |||
found = true | |||
break | |||
end | |||
end | |||
if not found then return false end | |||
elseif frame.args.blackListTags then | |||
local blacklist = {} | |||
for tag in string.gmatch(frame.args.blackListTags, "([^,]+)") do | |||
table.insert(blacklist, trim(tag)) | |||
end | |||
for _, btag in ipairs(blacklist) do | |||
if table.containsv(productTags, btag) then | |||
return false | |||
end | |||
end | |||
end | |||
return true | |||
end | |||
-- Функция фильтрации набора рецептов | |||
function p.filterRecipes(recipes, frame) | |||
local filtered = {} | |||
for id, recipe in pairs(recipes) do | |||
if p.recipePassesTags(frame, recipe) then | |||
filtered[id] = recipe | |||
end | |||
end | |||
return filtered | |||
end | |||
function getrecipesfromtype(frame, type) -- should not be invoked | function getrecipesfromtype(frame, type) -- should not be invoked | ||
| Строка 31: | Строка 127: | ||
function getimage(frame, fileid) -- should not be invoked | function getimage(frame, fileid) -- should not be invoked | ||
local out = "" | local out = "" | ||
local gifFileTitle = mw.title.new(fileid .. ".gif", "File") | --[[ | ||
WARNING!! THE NEXT THING IS "EXPENSIVE" AND DOES NOT WORKS AFTER 30 OR SMTHNG RUNS | |||
read https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Expensive_properties for more info | |||
local gifFileTitle = mw.title.new(fileid .. ".gif", "File") | |||
local pngFileTitle = mw.title.new(fileid .. ".png", "File") | |||
if gifFileTitle.file.exists then | |||
out = "File:" .. fileid .. ".gif" | |||
elseif pngFileTitle.file.exists then | |||
out = "File:" .. fileid .. ".png" | |||
else | |||
out = "" | |||
end | |||
--]] | |||
-- less expensive variant, but returns only png (AND BIG RED TEXT IF PNG DOES NOT EXISTS) | |||
out = "File:" .. fileid .. ".png" | |||
return out | return out | ||
end | end | ||
| Строка 57: | Строка 160: | ||
for item, amount in pairs(array) do | for item, amount in pairs(array) do | ||
out = out .. frame:preprocess("{{Chem Recipe Component|reagent=" .. item .. "|amount=" .. amount .. "}}") | out = out .. frame:preprocess("{{Chem Recipe Component|reagent=" .. item .. "|amount=" .. amount .. "}}") | ||
end | |||
return out | |||
end | |||
-- returns recipes which id is matched by pattern | |||
function getrecipesbyname(frame, tabl, str) -- should not be inviked | |||
local out = {} | |||
for type, recipes in pairs(tabl) do | |||
out[type] = {} | |||
for recipeId, recipe in pairs(recipes) do | |||
if string.match(recipeId, str) then | |||
table.insert(out[type], recipe) | |||
end | |||
end | |||
end | |||
return out | |||
end | |||
-- same as above, but returns recipes that *does not* match given pattern | |||
function getotherrecipes(frame, tabl, str) -- should not be invoked | |||
local out = {} | |||
for type, recipes in pairs(tabl) do | |||
if not table.containsk(out, type) then | |||
out[type] = {} | |||
end | |||
for recipeId, recipe in pairs(recipes) do | |||
if not string.match(recipeId, str) then | |||
if not table.containsv(out[type], recipe) then | |||
table.insert(out[type], recipe) | |||
end | |||
end | |||
end | |||
end | end | ||
return out | return out | ||
| Строка 94: | Строка 229: | ||
end | end | ||
function p.buildeverything(frame) | function p.buildeverything(frame) -- old code compatibility | ||
return p.buildeverythingnew(frame) | |||
end | |||
function p.buildeverythingold(frame) | |||
local out = "" | local out = "" | ||
out = out .. p.buildmicrowaverecipes(frame) | out = out .. p.buildmicrowaverecipes(frame) | ||
| Строка 136: | Строка 275: | ||
"|transformer={{Recipe Transformers|microwaveRecipes|" .. recipe["time"] .. "}}" .. | "|transformer={{Recipe Transformers|microwaveRecipes|" .. recipe["time"] .. "}}" .. | ||
"|result=" .. | "|result=" .. | ||
frame:preprocess("{{ | frame:preprocess("{{Result Component|item={{#invoke:Entity Lookup|getname|" .. | ||
recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "}}") .. | recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "}}") .. | ||
"}}") | "}}") | ||
| Строка 144: | Строка 283: | ||
function p.buildmicrowaverecipes(frame) | function p.buildmicrowaverecipes(frame) | ||
local out = "" | local out = "" | ||
local recipes = p.filterRecipes(getrecipesfromtype(frame, "microwaveRecipes"), frame) | |||
for id, _ in pairs(recipes) do | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildmicrowaverecipebox|" .. id .. "}}") .. "\n" | out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildmicrowaverecipebox|" .. id .. "}}") .. "\n" | ||
end | end | ||
| Строка 165: | Строка 305: | ||
"|transformer={{Recipe Transformers|sliceableRecipes}}" .. | "|transformer={{Recipe Transformers|sliceableRecipes}}" .. | ||
"|result=" .. | "|result=" .. | ||
frame:preprocess("{{ | frame:preprocess("{{Result Component|item={{#invoke:Entity Lookup|getname|" .. | ||
recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "|amount=" .. recipe["count"] .. "}}") .. | recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "|amount=" .. recipe["count"] .. "}}") .. | ||
"}}") | "}}") | ||
| Строка 173: | Строка 313: | ||
function p.buildslicerecipes(frame) | function p.buildslicerecipes(frame) | ||
local out = "" | local out = "" | ||
local recipes = p.filterRecipes(getrecipesfromtype(frame, "sliceableRecipes"), frame) | |||
for id, _ in pairs(recipes) do | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildslicerecipebox|" .. id .. "}}") .. "\n" | out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildslicerecipebox|" .. id .. "}}") .. "\n" | ||
end | end | ||
| Строка 183: | Строка 324: | ||
--#region grindableRecipes | --#region grindableRecipes | ||
function p.buildgrindrecipebox(frame) -- {{#invoke:Meals Lookup|buildgrindrecipebox| | function p.buildgrindrecipebox(frame) -- {{#invoke:Meals Lookup|buildgrindrecipebox|GrindableRecipeID}} | ||
local out = "" | local out = "" | ||
local id = frame.args[1]:gsub(' ', '') | local id = frame.args[1]:gsub(' ', '') | ||
| Строка 191: | Строка 332: | ||
"|name={{#invoke:Entity Lookup|getname|" .. recipe["id"] .. "}}" .. | "|name={{#invoke:Entity Lookup|getname|" .. recipe["id"] .. "}}" .. | ||
"|component-1=" .. | "|component-1=" .. | ||
frame:preprocess("{{ | frame:preprocess("{{Result Component|item={{#invoke:Entity Lookup|getname|" .. | ||
recipe["input"] .. "}}|image=" .. getimage(frame, recipe["input"]) .. "}}") .. | recipe["input"] .. "}}|image=" .. getimage(frame, recipe["input"]) .. "}}") .. | ||
"|transformer={{Recipe Transformers|grindableRecipes}}" .. | "|transformer={{Recipe Transformers|grindableRecipes}}" .. | ||
| Строка 201: | Строка 342: | ||
function p.buildgrindrecipes(frame) | function p.buildgrindrecipes(frame) | ||
local out = "" | local out = "" | ||
local recipes = p.filterRecipes(getrecipesfromtype(frame, "grindableRecipes"), frame) | |||
for id, _ in pairs(recipes) do | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildgrindrecipebox|" .. id .. "}}") .. "\n" | out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildgrindrecipebox|" .. id .. "}}") .. "\n" | ||
end | end | ||
| Строка 211: | Строка 353: | ||
--#region heatableRecipes | --#region heatableRecipes | ||
function p.buildheatrecipebox(frame) -- {{#invoke:Meals Lookup|buildheatrecipebox| | function p.buildheatrecipebox(frame) -- {{#invoke:Meals Lookup|buildheatrecipebox|HeatableRecipeID}} | ||
local out = "" | local out = "" | ||
local id = frame.args[1]:gsub(' ', '') | local id = frame.args[1]:gsub(' ', '') | ||
local recipe = getrecipe(frame, "heatableRecipes", id) | local recipe = getrecipe(frame, "heatableRecipes", id) | ||
out = frame:preprocess("{{Recipe Box" .. | out = frame:preprocess("{{Recipe Box" .. | ||
"|name={{#invoke:Entity Lookup|getname|" .. recipe[" | "|name={{#invoke:Entity Lookup|getname|" .. recipe["result"] .. "}}" .. | ||
"|component-1=" .. | "|component-1=" .. | ||
frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | ||
| Строка 222: | Строка 364: | ||
"|transformer={{Recipe Transformers|heatableRecipes|" .. recipe["minTemp"] .. "}}" .. | "|transformer={{Recipe Transformers|heatableRecipes|" .. recipe["minTemp"] .. "}}" .. | ||
"|result=" .. | "|result=" .. | ||
frame:preprocess("{{ | frame:preprocess("{{Result Component|item={{#invoke:Entity Lookup|getname|" .. | ||
recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "}}") .. | recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "}}") .. | ||
"}}") | "}}") | ||
| Строка 230: | Строка 372: | ||
function p.buildheatrecipes(frame) | function p.buildheatrecipes(frame) | ||
local out = "" | local out = "" | ||
local recipes = p.filterRecipes(getrecipesfromtype(frame, "heatableRecipes"), frame) | |||
for id, _ in pairs(recipes) do | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildheatrecipebox|" .. id .. "}}") .. "\n" | out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildheatrecipebox|" .. id .. "}}") .. "\n" | ||
end | end | ||
| Строка 240: | Строка 383: | ||
--#region toolmadeRecipes | --#region toolmadeRecipes | ||
function p.buildtoolmaderecipebox(frame) -- {{#invoke:Meals Lookup|buildtoolmaderecipebox| | function p.buildtoolmaderecipebox(frame) -- {{#invoke:Meals Lookup|buildtoolmaderecipebox|ToolmadeRecipeID}} | ||
local out = "" | local out = "" | ||
local id = frame.args[1]:gsub(' ', '') | local id = frame.args[1]:gsub(' ', '') | ||
| Строка 246: | Строка 389: | ||
local transformer = "toolmadeRecipes" .. recipe["tool"] | local transformer = "toolmadeRecipes" .. recipe["tool"] | ||
out = frame:preprocess("{{Recipe Box" .. | out = frame:preprocess("{{Recipe Box" .. | ||
"|name={{#invoke:Entity Lookup|getname|" .. recipe[" | "|name={{#invoke:Entity Lookup|getname|" .. recipe["result"] .. "}}" .. | ||
"|component-1=" .. | "|component-1=" .. | ||
frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | ||
recipe["input"] .. "}}|image= | recipe["input"] .. "}}|image=" .. getimage(frame, recipe["input"]) .. "}}") .. | ||
"|transformer={{Recipe Transformers|" .. transformer .. "}}" .. | "|transformer={{Recipe Transformers|" .. transformer .. "}}" .. | ||
"|result=" .. | "|result=" .. | ||
frame:preprocess("{{ | frame:preprocess("{{Result Component|item={{#invoke:Entity Lookup|getname|" .. | ||
recipe["result"] .. "}}|image= | recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "}}") .. | ||
"}}") | "}}") | ||
return out | return out | ||
| Строка 260: | Строка 403: | ||
function p.buildtoolmaderecipes(frame) | function p.buildtoolmaderecipes(frame) | ||
local out = "" | local out = "" | ||
local recipes = p.filterRecipes(getrecipesfromtype(frame, "toolmadeRecipes"), frame) | |||
for id, _ in pairs(recipes) do | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildtoolmaderecipebox|" .. id .. "}}") .. "\n" | out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildtoolmaderecipebox|" .. id .. "}}") .. "\n" | ||
end | end | ||
| Строка 270: | Строка 414: | ||
--#region mixableRecipes | --#region mixableRecipes | ||
function getchemicalreagents(recipe) | function getchemicalreagents(recipe) -- should not be invoked | ||
local out = {} | local out = {} | ||
for ingredient, data in pairs(recipe["reactants"]) do | for ingredient, data in pairs(recipe["reactants"]) do | ||
| Строка 278: | Строка 422: | ||
end | end | ||
function p.buildmixablerecipebox(frame) -- {{#invoke:Meals Lookup|buildmixablerecipebox| | function p.buildmixablerecipebox(frame) -- {{#invoke:Meals Lookup|buildmixablerecipebox|MixableRecipeID}} | ||
local out = "" | local out = "" | ||
local id = frame.args[1]:gsub(' ', '') | local id = frame.args[1]:gsub(' ', '') | ||
local recipe = p.chemicals[id] | local recipe = p.chemicals[id] | ||
local input = buildreagents(frame, getchemicalreagents(recipe)) | local input = buildreagents(frame, getchemicalreagents(recipe)) | ||
local | |||
local | local results = {} | ||
for _, v in pairs(recipe["effects"]) do | |||
table.insert(results, v.description) | |||
end | |||
local result = table.concat(results, "\n") | |||
out = frame:preprocess("{{Recipe Box" .. | out = frame:preprocess("{{Recipe Box" .. | ||
"|component-1=" .. input .. | "|component-1=" .. input .. | ||
"|name= " .. | |||
"|transformer={{Recipe Transformers|mixableRecipes}}" .. | "|transformer={{Recipe Transformers|mixableRecipes}}" .. | ||
"|result= | "|result=" .. result .. "}}") | ||
return out | return out | ||
end | end | ||
| Строка 297: | Строка 445: | ||
function p.buildixablerecipes(frame) | function p.buildixablerecipes(frame) | ||
local out = "" | local out = "" | ||
local recipes = p.filterRecipes(getrecipesfromtype(frame, "mixableRecipes"), frame) | |||
for id, _ in pairs(recipes) do | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildmixablerecipebox|" .. id .. "}}") .. "\n" | out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildmixablerecipebox|" .. id .. "}}") .. "\n" | ||
end | end | ||
| Строка 305: | Строка 454: | ||
--#endregion mixableRecipes | --#endregion mixableRecipes | ||
--#region dishes | |||
function p.buildrecipeboxuniversal(frame, idtable) | |||
local out = "" | |||
for type, recipes in pairs(idtable) do | |||
-- INTRUDER ALERT: SHITCODE IS IN THE BASE | |||
local id = "" | |||
if type == "microwaveRecipes" and not table.isempty(recipes) then | |||
do | |||
for n, recipe in pairs(recipes) do | |||
if p.recipePassesTags(frame, recipe) then | |||
id = recipe["id"] | |||
out = out .. | |||
frame:preprocess("{{#invoke:Meals Lookup|buildmicrowaverecipebox|" .. id .. "}}") .. "\n" | |||
end | |||
end | |||
end | |||
elseif type == "mixableRecipes" and not table.isempty(recipes) then | |||
do | |||
for n, recipe in pairs(recipes) do | |||
if p.recipePassesTags(frame, recipe) then | |||
id = recipe["id"] | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildmixablerecipebox|" .. id .. "}}") .. "\n" | |||
end | |||
end | |||
end | |||
elseif type == "sliceableRecipes" and not table.isempty(recipes) then | |||
do | |||
for n, recipe in pairs(recipes) do | |||
if p.recipePassesTags(frame, recipe) then | |||
id = recipe["id"] | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildslicerecipebox|" .. id .. "}}") .. "\n" | |||
end | |||
end | |||
end | |||
elseif type == "grindableRecipes" and not table.isempty(recipes) then | |||
do | |||
for n, recipe in pairs(recipes) do | |||
if p.recipePassesTags(frame, recipe) then | |||
id = recipe["id"] | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildgrindrecipebox|" .. id .. "}}") .. "\n" | |||
end | |||
end | |||
end | |||
elseif type == "heatableRecipes" and not table.isempty(recipes) then | |||
do | |||
for n, recipe in pairs(recipes) do | |||
if p.recipePassesTags(frame, recipe) then | |||
id = recipe["id"] | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildheatrecipebox|" .. id .. "}}") .. "\n" | |||
end | |||
end | |||
end | |||
elseif type == "toolmadeRecipes" and not table.isempty(recipes) then | |||
do | |||
for n, recipe in pairs(recipes) do | |||
if p.recipePassesTags(frame, recipe) then | |||
id = recipe["id"] | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildtoolmaderecipebox|" .. id .. "}}") .. "\n" | |||
end | |||
end | |||
end | |||
end | |||
end | |||
return out | |||
end | |||
-- you should not use this for building recipes inside lua | |||
function p.buildnamedrecipes(frame) -- {{#invoke:Meals Lookup|buildnamedrecipes|[Pattern1 | Pattern2 | Pattern3 | ...]}} | |||
local out = "" | |||
local tablo = p.meals | |||
for _, patt in pairs(frame.args) do | |||
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. | function p.buildotherrecipes(frame) -- {{#invoke:Meals Lookup|buildotherrecipes|[Pattern1 | Pattern2 | Pattern3 | ...]}} | ||
local out = "" | 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) | |||
end | |||
return out | return out | ||
end | end | ||
-- builds recipes list but does not constructs it, for debug purposes | |||
function p.getrecipeslist(frame) | |||
local out = "" | |||
local tablo = p.meals | |||
for _, patt in pairs(frame.args) do | |||
for type, recipes in pairs(getrecipesbyname(frame, tablo, patt)) do | |||
out = out .. type .. "(" | |||
for k, r in pairs(recipes) do | |||
out = out .. " " .. k .. ":" .. r["id"] | |||
end | |||
out = out .. ")" | |||
end | |||
end | |||
return out | |||
end | |||
-- same as getrecipeslist, but instead returns recipes that does not match the pattern | |||
function p.getotherrecipeslist(frame) | |||
local out = "" | |||
local tablo = p.meals | |||
for _, patt in pairs(frame.args) do | |||
for type, recipes in pairs(getotherrecipes(frame, tablo, patt)) do | |||
out = out .. type .. "(" | |||
for k, r in pairs(recipes) do | |||
out = out .. " " .. k .. ":" .. r["id"] | |||
end | |||
out = out .. ")" | |||
end | |||
end | |||
return out | |||
end | |||
--#endregion | |||
--#region newdishestest | |||
-- returns recipes which id is matched by pattern | |||
function getrecipesbynamenew(frame, tabl, str) -- should not be invoked | |||
local out = {} | |||
for rtype, recipes in pairs(tabl) do | |||
for recipeId, recipe in pairs(recipes) do | |||
out[rtype] = out[rtype] or {} | |||
if type(str) == "table" then | |||
for _, patt in pairs(str) do | |||
if string.match(recipeId, patt) and not table.containsv(recipe) then | |||
table.insert(out[rtype], recipe) | |||
end | |||
end | |||
else | |||
if string.match(recipeId, str) then | |||
table.insert(out[rtype], recipe) | |||
end | |||
end | |||
end | |||
end | |||
return out | |||
end | |||
-- same as above, but returns recipes that *does not* match given pattern | |||
function getotherrecipesnew(frame, tabl, str) -- should not be invoked | |||
local out = {} | |||
for type, recipes in pairs(tabl) do | |||
out[type] = out[type] or {} | |||
for recipeId, recipe in pairs(recipes) do | |||
if not string.match(recipeId, str) then | |||
if not table.containsv(out[type], recipe) then | |||
table.insert(out[type], recipe) | |||
end | |||
end | |||
end | |||
end | |||
return out | |||
end | |||
-- you should not use this for building recipes inside lua | |||
function p.buildnamedrecipesnew(frame) -- {{#invoke:Meals Lookup|buildnamedrecipes|[Pattern1 | Pattern2 | Pattern3 | ...]}} | |||
local out = "" | |||
local tablo = p.meals | |||
for _, patt in pairs(frame.args) do | |||
local ids = getrecipesbynamenew(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.buildotherrecipesnew(frame) -- {{#invoke:Meals Lookup|buildotherrecipes|[Pattern1 | Pattern2 | Pattern3 | ...]}} | |||
local out = "" | |||
local tablo = p.meals | |||
for _, patt in pairs(frame.args) do | |||
local ids = getotherrecipesnew(frame, tablo, patt) | |||
out = out .. p.buildrecipeboxuniversal(frame, ids) | |||
end | |||
return out | |||
end | |||
--#endregion | |||
return p | return p | ||