Module:Sandbox/Star0/1:修订间差异
(// Edit via Wikiplus) |
小无编辑摘要 |
||
第2行: | 第2行: | ||
local Gjson = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{ title = 'Songlist' } ) | local Gjson = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{ title = 'Songlist' } ) | ||
local loadJson = require('Module:LoadJson') | |||
function p.main() | function p.main() | ||
json = Gjson | |||
s = #json["songs"] | |||
return s | |||
end | |||
function p.maint() | |||
if json == nil | |||
then json = loadJson.Songlist() | |||
end | |||
s = #json["songs"] | s = #json["songs"] | ||
return s | return s |
2022年7月27日 (三) 23:48的版本
可在Module:Sandbox/Star0/1/doc创建此模块的帮助文档
local p = {}
local Gjson = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{ title = 'Songlist' } )
local loadJson = require('Module:LoadJson')
function p.main()
json = Gjson
s = #json["songs"]
return s
end
function p.maint()
if json == nil
then json = loadJson.Songlist()
end
s = #json["songs"]
return s
end
c = nil
function p.test()
if c==nil then return '无值' end
c = 2
return '有值'
end
return p