模块:测试调用数据

可在模块:测试调用数据/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