跳转到内容

模組:Carousel

维基百科,自由的百科全书

这是本页的一个历史版本,由PhiLiP留言 | 贡献2017年2月14日 (二) 04:53 建立内容为“local p = {} function getCandidateList(args) local page = mw.title.new(args.pageName) return mw.text.jsonDecode(page:getContent(), mw.text.JSON_T...”的新页面)编辑。这可能和当前版本存在着巨大的差异。

(差异) ←上一修订 | 最后版本 (差异) | 下一修订→ (差异)

local p = {}

function getCandidateList(args)
	local page = mw.title.new(args.pageName)
	return mw.text.jsonDecode(page:getContent(), mw.text.JSON_TRY_FIXING)
end

function p.main(frame)
	local candidateList = getCandidateList{pageName = frame.args.candidateList}
	local timeStart = frame.args.timeStart or 0
	local timeInterval = frame.args.timeInterval or 86400
	local index0 = math.floor((os.time() - timeStart) / 86400) % #candidateList
	return "{{:" .. candidateList[index0 + 1] .. "}}"
end

return p