Модуль:Prototypes/Роль/Лодаут: различия между версиями

мНет описания правки
мНет описания правки
Строка 36: Строка 36:
         end
         end
         if group then
         if group then
             if type(group.loadouts) == "string" then
            local loadouts = group.loadouts or {}
                 local success, decoded = pcall(mw.text.jsonDecode, group.loadouts)
             if type(loadouts) == "string" then
                 local success, decoded = pcall(mw.text.jsonDecode, loadouts)
                 if success and type(decoded) == "table" then
                 if success and type(decoded) == "table" then
                     group.loadouts = decoded
                     loadouts = decoded
                 else
                 else
                     group.loadouts = {}
                     loadouts = {}
                 end
                 end
             end
             end


             for _, loadoutId in ipairs(group.loadouts or {}) do
             for _, loadoutId in ipairs(loadouts) do
                 local loadout = nil
                 local loadout = nil
                 for _, l in ipairs(gearloadout) do
                 for _, l in ipairs(gearloadout) do