模块:中立&怪物卡牌灵光一闪:修订间差异
来自卡厄思梦境WIKI
无编辑摘要 |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
local p = {} | local p = {} | ||
local data = mw.loadData("模块:中立&怪物卡牌灵光一闪/data") | local data = mw.loadData("模块:中立&怪物卡牌灵光一闪/data") | ||
-- 主函数 | -- 主函数 | ||
function p.show(frame) | function p.show(frame) | ||
local output = "" | local output = "" | ||
-- | -- 构建包含所有数据的表格 | ||
output = output .. "=== 结果 ===\n" | output = output .. "=== 结果 ===\n" | ||
local html = mw.html.create('table') | local html = mw.html.create('table') | ||
html:addClass('wikitable sortable') | html:addClass('wikitable sortable') | ||
html:attr('id', 'card-results-table') | |||
-- 表头 | -- 表头 | ||
| 第163行: | 第23行: | ||
-- 数据行 | -- 数据行 | ||
for _, item in ipairs( | for _, item in ipairs(data) do | ||
local row = html:tag('tr') | local row = html:tag('tr') | ||
row:attr('data-type', item.type or "") | |||
row:attr('data-dict-include', item.dict_include or "") | |||
row:attr('data-dict-exclude', item.dict_exclude or "") | |||
row:attr('data-class', item.class or "") | |||
row:attr('data-cost-min', tostring(item.cost_min)) | |||
row:attr('data-cost-max', tostring(item.cost_max)) | |||
row:tag('td'):wikitext(item.desc_global or "") | row:tag('td'):wikitext(item.desc_global or "") | ||
row:tag('td'):wikitext(tostring(item.cost_min)) | row:tag('td'):wikitext(tostring(item.cost_min)) | ||
| 第175行: | 第42行: | ||
output = output .. tostring(html) | output = output .. tostring(html) | ||
output = output .. "\n\n''共 " .. # | output = output .. "\n\n<div id='result-count'>''共 " .. #data .. " 条结果''</div>" | ||
return output | return output | ||
2025年11月3日 (一) 13:36的最新版本
此模块的文档可以在模块:中立&怪物卡牌灵光一闪/doc创建
local p = {}
local data = mw.loadData("模块:中立&怪物卡牌灵光一闪/data")
-- 主函数
function p.show(frame)
local output = ""
-- 构建包含所有数据的表格
output = output .. "=== 结果 ===\n"
local html = mw.html.create('table')
html:addClass('wikitable sortable')
html:attr('id', 'card-results-table')
-- 表头
local headerRow = html:tag('tr')
headerRow:tag('th'):wikitext('描述')
headerRow:tag('th'):wikitext('最低费用')
headerRow:tag('th'):wikitext('最高费用')
headerRow:tag('th'):wikitext('类型')
headerRow:tag('th'):wikitext('包含机制')
headerRow:tag('th'):wikitext('排除机制')
headerRow:tag('th'):wikitext('职业')
-- 数据行
for _, item in ipairs(data) do
local row = html:tag('tr')
row:attr('data-type', item.type or "")
row:attr('data-dict-include', item.dict_include or "")
row:attr('data-dict-exclude', item.dict_exclude or "")
row:attr('data-class', item.class or "")
row:attr('data-cost-min', tostring(item.cost_min))
row:attr('data-cost-max', tostring(item.cost_max))
row:tag('td'):wikitext(item.desc_global or "")
row:tag('td'):wikitext(tostring(item.cost_min))
row:tag('td'):wikitext(tostring(item.cost_max))
row:tag('td'):wikitext(item.type or "")
row:tag('td'):wikitext(item.dict_include or "")
row:tag('td'):wikitext(item.dict_exclude or "")
row:tag('td'):wikitext(item.class or "")
end
output = output .. tostring(html)
output = output .. "\n\n<div id='result-count'>''共 " .. #data .. " 条结果''</div>"
return output
end
return p