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

Нет описания правки
Нет описания правки
Строка 26: Строка 26:
     end
     end
     return false
     return false
end
function table.length(table)
    local out = 0
    for _ in table do
        out = out + 1
    end
    return out
end
end


function table.isempty(table)
function table.isempty(table)
     local count = 0
     local count = table.length(table)
    for _ in pairs(table) do
        count = count + 1
    end
     if count == 0 then
     if count == 0 then
         do
         do
Строка 494: Строка 499:
     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 .. table.length(ids)
         for type, recipes in pairs(ids) do
         for type, recipes in pairs(ids) do
             for n, recipe in pairs(recipes) do
             for n, recipe in pairs(recipes) do