Модуль:TableOfChemicals: различия между версиями

мНет описания правки
мНет описания правки
Строка 25: Строка 25:
local reactPrototype = p.react[reactId]
local reactPrototype = p.react[reactId]
local reactants = {}
local reactants = {}
local reactantTemplate = "%s [[#%s|%s]]"
for reactantId, reactantValue in pairs(reactPrototype.reactants) do
for reactantId, reactantValue in pairs(reactPrototype.reactants) do
local reactantChemData = p.chem[reactantId]
local reactantChemData = p.chem[reactantId]
local reactantText = reactantValue.amount .. " " .. reactantChemData.name  
local reactantText = string.format(reactantTemplate, reactantValue.amount, reactantChemData.id,  reactantChemData.name)
table.insert(reactants, reactantText)
table.insert(reactants, reactantText)
end
end