Модуль:Meals Lookup: различия между версиями
Mhamster (обсуждение | вклад) Нет описания правки |
Mhamster (обсуждение | вклад) Нет описания правки |
||
| Строка 22: | Строка 22: | ||
for k, _ in pairs(table) do | for k, _ in pairs(table) do | ||
if k == key then | if k == key then | ||
return true | |||
end | |||
end | |||
return false | |||
end | |||
function table.isempty(table) | |||
local count = 0 | |||
for _ in pairs(table) do | |||
count = count + 1 | |||
end | |||
if count == 0 then | |||
do | |||
return true | return true | ||
end | end | ||
| Строка 377: | Строка 390: | ||
-- INTRUDER ALERT: SHITCODE IS IN THE BASE | -- INTRUDER ALERT: SHITCODE IS IN THE BASE | ||
local id = "" | local id = "" | ||
if type == "microwaveRecipes" and not | if type == "microwaveRecipes" and not table.isempty(recipes) == nil then | ||
do | do | ||
for n, recipe in pairs(recipes) do | for n, recipe in pairs(recipes) do | ||
id = recipe["id"] | id = recipe["id"] | ||
out = out .. id | out = out .. id | ||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildmicrowaverecipebox|" .. id .. "}}") .. "\n" | out = out .. | ||
frame:preprocess("{{#invoke:Meals Lookup|buildmicrowaverecipebox|" .. id .. "}}") .. "\n" | |||
end | end | ||
end | end | ||
elseif type == "mixableRecipes" and not | elseif type == "mixableRecipes" and not table.isempty(recipes) == nil then | ||
do | do | ||
for n, recipe in pairs(recipes) do | for n, recipe in pairs(recipes) do | ||
| Строка 393: | Строка 407: | ||
end | end | ||
end | end | ||
elseif type == "sliceableRecipes" and not | elseif type == "sliceableRecipes" and not table.isempty(recipes) == nil then | ||
do | do | ||
for n, recipe in pairs(recipes) do | for n, recipe in pairs(recipes) do | ||
| Строка 401: | Строка 415: | ||
end | end | ||
end | end | ||
elseif type == "grindableRecipes" and not | elseif type == "grindableRecipes" and not table.isempty(recipes) == nil then | ||
do | do | ||
for n, recipe in pairs(recipes) do | for n, recipe in pairs(recipes) do | ||
| Строка 409: | Строка 423: | ||
end | end | ||
end | end | ||
elseif type == "heatableRecipes" and not | elseif type == "heatableRecipes" and not table.isempty(recipes) == nil then | ||
do | do | ||
for n, recipe in pairs(recipes) do | for n, recipe in pairs(recipes) do | ||
| Строка 417: | Строка 431: | ||
end | end | ||
end | end | ||
elseif type == "toolmadeRecipes" and not | elseif type == "toolmadeRecipes" and not table.isempty(recipes) == nil then | ||
do | do | ||
for n, recipe in pairs(recipes) do | for n, recipe in pairs(recipes) do | ||
| Строка 478: | Строка 492: | ||
for n, recipe in pairs(recipes) do | for n, recipe in pairs(recipes) do | ||
id = recipe["id"] | id = recipe["id"] | ||
out = out .. id .. "\n" | |||
end | end | ||
end | end | ||
| Строка 485: | Строка 499: | ||
return out | return out | ||
end | end | ||
-- function p.tests2(frame) | -- function p.tests2(frame) | ||