Модуль:Prototypes/Хранилище/Предмет: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| Строка 68: | Строка 68: | ||
local item = findDataById(data, id) | local item = findDataById(data, id) | ||
if not item then return '' end | if not item then return '' end | ||
if item.StorageFill and item.StorageFill.contents then | if item.StorageFill and item.StorageFill.contents then | ||
| Строка 80: | Строка 78: | ||
result = result .. 'Таблица не найдена.' | result = result .. 'Таблица не найдена.' | ||
end | end | ||
end | end | ||
| Строка 107: | Строка 101: | ||
end | end | ||
-- Основная функция модуля | |||
-- Основная функция модуля | -- Основная функция модуля | ||
function p.main(frame) | function p.main(frame) | ||
| Строка 117: | Строка 112: | ||
if not data then return 'Не удалось загрузить данные.' end | if not data then return 'Не удалось загрузить данные.' end | ||
-- При режиме framing | |||
if mode == 'framing' then | |||
local subMode = frame.args[2] -- второй параметр | |||
if subMode == 'chem' then | |||
return mw.getCurrentFrame():preprocess('{{СollapsibleMenu|' .. getChemOutput(data, id) .. '}}') | |||
elseif subMode == 'contained' then | |||
return mw.getCurrentFrame():preprocess('{{СollapsibleMenu|' .. getContainedOutput(data, id, false) .. '}}') | |||
else | |||
return 'Неизвестный подрежим для framing: ' .. subMode | |||
end | |||
end | |||
-- При нормальном режиме | |||
if mode == 'chem' then | if mode == 'chem' then | ||
return getChemOutput(data, id) | return getChemOutput(data, id) | ||
elseif mode == 'contained' then | elseif mode == 'contained' then | ||
return getContainedOutput(data, id, false) | return getContainedOutput(data, id, false) | ||
else | else | ||
return 'Неизвестный режим: ' .. mode | return 'Неизвестный режим: ' .. mode | ||
end | end | ||
end | end | ||