模块:JSON

来自乐园数据管理室
ヒカリ​(留言 | 贡献)2019年3月20日 (三) 16:52的版本 (创建页面,内容为“local p = {} function p.loadJson(pagename) local title = mw.title.new(pagename, "JSON") if not title.exists then error(pagename .. "不存在") end return mw.…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

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

local p = {}

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

return p