模块:物品信息

NegativeTriu讨论 | 贡献2022年1月4日 (二) 07:30的版本 (创建页面,内容为“local p = {} function p.info(frame) local jsdata = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{title = "物品信息/json"}) local num = tonumber…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

此模块的文档可以在模块:物品信息/doc创建

local p = {}

function p.info(frame)
    local jsdata = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{title = "物品信息/json"})
    local num = tonumber(frame.args.num)
    if jsdata[frame.args.name][num] == nil then return ""
    else return jsdata[frame.args.name][num]
    end
end

return p