Модуль:Песочница/Pok
Для документации этого модуля может быть создана страница Модуль:Песочница/Pok/doc
-- Загружаем данных
local cargoData = mw.loadData("Модуль:IanComradeBot/prototypes/cargo/bounty.json/base")
local p = {}
function p.table(frame)
local output = {}
for _, item in pairs(cargoData) do
local reward = item.reward or ""
local description = item.description or ""
if item.entries then
for _, entry in ipairs(item.entries) do
local product = entry.name or ""
local amount = entry.amount or ""
table.insert(output, '|data-sort-value=' .. reward .. '|')
local cellTemplate = string.format(
"{{Cut-Layout|1=<b>{{color|#{{ColorPalette|Threat codes|Gamma}}|%s x%s}}</b>|2={{ColorPalette|Other|price|$%s}}|3=%s}}",
frame:preprocess('{{#invoke:Ftl|main|translation|' .. product .. '}}'),
amount,
reward,
frame:preprocess('{{#invoke:Ftl|main|translation|' .. description .. '}}')
)
table.insert(output, cellTemplate)
table.insert(output, '|-')
end
end
end
return frame:preprocess(table.concat(output, "\n"))
end
return p