Модуль:Prototypes/Хранилище/Предмет: различия между версиями

мНет описания правки
мНет описания правки
Строка 179: Строка 179:
         end
         end
     end
     end
    return result
end
-- Обработка GroupSelector с корректной вложенностью
handleGroupSelector = function(groupSelector)
    local result = ''
    -- Проверка на существование children
    if not groupSelector.children then
        return ""
    end
    local weight = groupSelector.weight or "default"
    result = result .. string.format('<div class="together" id="%s">', weight)
    for _, child in ipairs(groupSelector.children) do
        if child["!type"] == "GroupSelector" then
            result = result .. handleGroupSelector(child)
        elseif child["!type"] == "AllSelector" then
            result = result .. string.format('<div class="AllSelector">')
            result = result .. handleAllSelector(child)
            result = result .. '</div>'
        elseif child.id then
            result = result .. string.format('<div class="item">%s</div>', formatContent(child))
        else
            result = result .. "<div>Ошибка: отсутствует id у элемента.</div>"
        end
    end
   
    result = result .. '</div>'


     return result
     return result