卡厄思
梦
境
菜单
首页
回到首页
WIKI工具
全站样式
全站JS
修改导航栏
测试
沙盒
可视化管理器
战斗员管理器
卡牌管理器
伙伴管理器
装备管理器
词典管理器
图鉴
战斗员
伙伴
装备
怪物卡牌
中立卡牌
词典
小工具
配队模拟器
节奏榜生成器
搜索
链入页面
相关更改
特殊页面
页面信息
最近更改
登录
模块
查看“︁词典表格”︁的源代码
←
模块:词典表格
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} local data = require('Module:词典/data') function p.renderTable(frame) local result = {} local rows = {} -- 收集所有数据到rows表中 for name, entries in pairs(data.dictionary) do for _, entry in ipairs(entries) do table.insert(rows, { name = name, icon = entry["icon"] or "", type = entry["类型"] or "", color = entry["颜色"] or "", description = entry["描述"] or "" }) end end -- 按类型排序 table.sort(rows, function(a, b) -- 首先按类型排序 if a.type ~= b.type then -- 定义类型排序优先级 local typeOrder = { ["卡牌机制"] = 1, ["战斗员专属机制"] = 2, ["角色专属词条"] = 3, ["buff"] = 4, ["debuff"] = 5 } local orderA = typeOrder[a.type] or 999 local orderB = typeOrder[b.type] or 999 if orderA ~= orderB then return orderA < orderB end return a.type < b.type end -- 如果类型相同,按名称排序 return a.name < b.name end) -- 生成表格行 for _, row in ipairs(rows) do local rowHtml = {} table.insert(rowHtml, '|-') -- 添加数据属性用于筛选 table.insert(rowHtml, string.format('data-param1="%s"', row.type)) -- 图标单元格 table.insert(rowHtml, '\n|' .. row.icon) -- 名称单元格 table.insert(rowHtml, '\n|' .. row.name) -- 类型单元格 table.insert(rowHtml, '\n|' .. row.type) -- 描述单元格 table.insert(rowHtml, '\n|' .. row.description) table.insert(result, table.concat(rowHtml, ' ')) end return table.concat(result, '\n') end return p
该页面使用的模板:
模块:词典表格/doc
(
查看源代码
)
返回
模块:词典表格
。