Модуль:TableOfChemicals: различия между версиями
мНет описания правки |
мНет описания правки |
||
| Строка 4: | Строка 4: | ||
p.chem = prototypes.chem | p.chem = prototypes.chem | ||
p.react = prototypes.react | p.react = prototypes.react | ||
p.fillTable = function(frame) | p.fillTable = function(frame) | ||
| Строка 39: | Строка 33: | ||
local reactPrototype = p.react[reactId] | local reactPrototype = p.react[reactId] | ||
local reactants = {} | local reactants = {} | ||
local | 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 | local reactantText = string.format(reactantTemplate, reactantValue.amount, reactantChemData.id, reactantChemData.name) | ||
table.insert(reactants, reactantText) | table.insert(reactants, reactantText) | ||
end | end | ||
| Строка 86: | Строка 75: | ||
p.fillEffectsTable = function(frame) | p.fillEffectsTable = function(frame) | ||
--Временно заполняем старым описанием эфектов | |||
local chemPrototypeId = frame.args.id | local chemPrototypeId = frame.args.id | ||
return p.geneffects(chemPrototypeId) | |||
local out = "{|" -- Объявление таблицы (Условие | Эффект) | [[local out = "{|" -- Объявление таблицы (Условие | Эффект) | ||
local rowTemplate = "|-\n| %s || %s" -- Шаблон строки таблицы | local rowTemplate = "|-\n| %s || %s" -- Шаблон строки таблицы | ||
| Строка 99: | Строка 90: | ||
out = attachAsNewLine(out, "|}") -- Конец таблицы | out = attachAsNewLine(out, "|}") -- Конец таблицы | ||
mw.log(out) | mw.log(out) | ||
return out | return out]] | ||
end | end | ||