模块:JSON:修订间差异
来自乐园数据管理室
无编辑摘要 |
无编辑摘要 |
||
| 第3行: | 第3行: | ||
function p.loadJson(pagename) | function p.loadJson(pagename) | ||
local title = mw.title.new(pagename, "JSON") | local title = mw.title.new(pagename, "JSON") | ||
if not title.exists then error(title .. "不存在") end | if not title.exists then error(tostring(title) .. "不存在") end | ||
return mw.text.jsonDecode(title:getContent()) | return mw.text.jsonDecode(title:getContent()) | ||
end | end | ||
return p | return p | ||
2019年3月20日 (三) 16:53的版本
此模块的文档可以在模块:JSON/doc创建
local p = {}
function p.loadJson(pagename)
local title = mw.title.new(pagename, "JSON")
if not title.exists then error(tostring(title) .. "不存在") end
return mw.text.jsonDecode(title:getContent())
end
return p