Модуль:Песочница/Pok: различия между версиями
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| Строка 284: | Строка 284: | ||
getChemOutput = function(itemData, id) | getChemOutput = function(itemData, id) | ||
local item = findDataById(itemData, id) | local item = findDataById(itemData, id) | ||
if not item or not item.SolutionContainerManager or not item.SolutionContainerManager.solutions then return '' end | if not item | ||
or not item.SolutionContainerManager | |||
or not item.SolutionContainerManager.solutions then | |||
return '' | |||
end | |||
local foodSolution = item.SolutionContainerManager.solutions["food"] | |||
if not foodSolution or not foodSolution.reagents then | |||
return '' | |||
end | |||
local result = "" | local result = "" | ||
for _, reagent in ipairs(foodSolution.reagents) do | |||
result = result .. string.format( | |||
'<li>[[Химия#chem_%s|%s]] (%d ед.)</li>', | |||
reagent.ReagentId, reagent.ReagentId, reagent.Quantity | |||
) | |||
end | end | ||
return string.format('<ul class="1">%s</ul>', result) | return string.format('<ul class="1">%s</ul>', result) | ||
end | end | ||