模块:JSON

来自乐园数据管理室
ヒカリ​(留言 | 贡献)2019年9月28日 (六) 23:47的版本
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

此模块的文档可以在模块:JSON/doc创建

local p = {}

function p.loadJson(pagename)
  local title = mw.title.new(pagename, "JSON")
  local content = title:getContent()
  if not content then error(tostring(title) .. " 页面不存在") end
  return mw.text.jsonDecode(content)
end

return p