模块:测试调用数据:修订间差异
无编辑摘要 |
小无编辑摘要 |
||
第2行: | 第2行: | ||
local db = mw.loadData('模块:角色属性数据') | local db = mw.loadData('模块:角色属性数据') | ||
local dataList = db.char_self_data | local dataList = db.char_self_data | ||
local elements = {"HP", "SP", "ATK", "DEF", "MAG", "MDEF", "CRT", "SPD"} | local elements = {"HP", "SP", "ATK", "DEF", "MAG", "MDEF", "CRT", "SPD"} | ||
p["测试调用"] = function(frame) | p["测试调用"] = function(frame) | ||
local query_num = frame.args['角色编号'] | |||
for _, char in ipairs(dataList) do | for _, char in ipairs(dataList) do | ||
if query_num == char.owner_order then | if query_num == char.owner_order then |
2024年6月26日 (三) 17:39的版本
可在模块:测试调用数据/doc创建此模块的帮助文档
local p = {}
local db = mw.loadData('模块:角色属性数据')
local dataList = db.char_self_data
local elements = {"HP", "SP", "ATK", "DEF", "MAG", "MDEF", "CRT", "SPD"}
p["测试调用"] = function(frame)
local query_num = frame.args['角色编号']
for _, char in ipairs(dataList) do
if query_num == char.owner_order then
for _, element in ipairs(elements) do
local maxAttr = "MAX" .. element
local maxAttrValue = char.Data_jp[maxAttr]
testTable(maxAttr, maxAttrValue)
local baseAttr = "Base" .. element
local baseAttrValue = char.Data_jp[maxAttr]
testTable(baseAttr, baseAttrValue)
end
end
end
end
function testTable(a,b)
table.insert(result, a .. ":".. b)
end
return p