Модуль:tableofchemicals

Вернуться

Строка 23: Строка 23:
-- Если нет продуктов, пропускаем эту реакцию
-- Если нет продуктов, пропускаем эту реакцию
if mainProduct == nil then
if mainProduct ~= nil then
-- ничего не делаем, переходим к следующей итерации
else
-- Заполняем данные для колонки "Вещество"
-- Заполняем данные для колонки "Вещество"
templateArgs.id = mainProduct.id
templateArgs.id = mainProduct.id
Строка 64: Строка 62:
-- Эффекты реакции
-- Эффекты реакции
if tablelength(reactPrototype.effects) then
if reactPrototype.effects and tablelength(reactPrototype.effects) > 0 then
for _, effect in pairs(reactPrototype.effects) do
for _, effect in pairs(reactPrototype.effects) do
if effect.description ~= "" then
if effect.description ~= "" then
Строка 204: Строка 202:
end
end
-- Эффекты реакции
-- Эффекты реакции
if tablelength(reactPrototype.effects) then
if reactPrototype.effects and tablelength(reactPrototype.effects) > 0 then
for _, effect in pairs(reactPrototype.effects) do
for _, effect in pairs(reactPrototype.effects) do
if effect.description ~= "" then
if effect.description ~= "" then
Строка 231: Строка 229:
local actions = {}
local actions = {}
for _, mixingCategory in pairs(reactPrototype.mixingCategories) do
if reactPrototype.mixingCategories then
local image = getMixingImage(mixingCategory.id)
for _, mixingCategory in pairs(reactPrototype.mixingCategories) do
if image ~= nil then
local image = getMixingImage(mixingCategory.id)
table.insert(actions, string.format("[[File:%s|32px|link=]]", image)) -- Картинка
if image ~= nil then
table.insert(actions, string.format("[[File:%s|32px|link=]]", image)) -- Картинка
end
table.insert(actions, mixingCategory.name or mixingCategory.id) -- Название
end
end
table.insert(actions, mixingCategory.name or mixingCategory.id) -- Название
end
end