模块:测试调用数据
可在模块:测试调用数据/doc创建此模块的帮助文档
local p = {}
-- 加载数据
local db_cn = mw.loadData('模块:角色技能数据中文')
local dataList_cn = db_cn.char_skill_data
local db_jp = mw.loadData('模块:角色技能数据日文')
local dataList_jp = db_jp.char_skill_data
p["测试调用"] = function(frame)
local query_num = frame.args['角色序号']
local query_type = frame.args['查询类型']
local query_lang = frame.args['查询语言'] or ""
local html = mw.html.create()
-- 提取数据
local dataList = (query_lang == "cn" or query_lang == "国服") and dataList_cn or dataList_jp
for _, ownerList in ipairs(dataList) do
if query_num == ownerList.owner_order then
local skillList = ownerList.owner_skill
if skillList then
html:tag('div'):wikitext('找到序号为'..query_num..'类型为'..query_type..'语言为'..query_lang..'的技能组')
end
for _, skill in ipairs(skillList) do
if skill.skill_parent ~= nil and query_type == skill.skill_type then
html:tag('div'):wikitext(skill.skill_name .. skill.skill_content)
end
end
end
end
return tostring(html)
end
return p