模块:测试调用数据:修订间差异
无编辑摘要 |
无编辑摘要 |
||
第1行: | 第1行: | ||
local p = {} | local p = {} | ||
local db = | local db = mw.loadData('模块:角色属性数据') | ||
local dataList = db. | local dataList = db.char_self_data | ||
local query_num = frg['角色序号'] | |||
local elements = {"HP", "SP", "ATK", "DEF", "MAG", "MDEF", "CRT", "SPD"} | |||
p[" | p["测试调用"] = function(frame) | ||
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) | |||
for | |||
if | |||
for _, | |||
end | end | ||
end | end | ||
end | end | ||
end | |||
function testTable(a,b) | |||
table.insert(result, a .. ":".. b) | |||
end | end | ||
return p | return p |
2024年6月26日 (三) 17:37的版本
可在模块:测试调用数据/doc创建此模块的帮助文档
local p = {}
local db = mw.loadData('模块:角色属性数据')
local dataList = db.char_self_data
local query_num = frg['角色序号']
local elements = {"HP", "SP", "ATK", "DEF", "MAG", "MDEF", "CRT", "SPD"}
p["测试调用"] = function(frame)
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