跳转到内容

模組:LoadPage

被永久保护的模块
维基百科,自由的百科全书

这是本页的一个历史版本,由Xiplus-abot留言 | 贡献2024年1月6日 (六) 20:51 (已保护“Module:LoadPage”:​高風險模板:24152引用<!-- 機器人3 -->([编辑=仅允许模板编辑员](无限期)[移动=仅允许模板编辑员](无限期)))编辑。这可能和当前版本存在着巨大的差异。

local p = {}

function p.loadpage(page)
	local page_name = page
	if type(page) == type({}) then page_name = (page.args or page)[1]
	elseif type(page) == type(nil) then return ''
	elseif type(page) ~= type("string") then page_name = tostring(page) end
	page_name = tostring(page_name or '')
	if mw.text.trim(page_name) ~= '' then
		local title_obj = mw.title.new(page_name)
		pcall(title_obj.getContent, title_obj)
	end
	return ''
end

return p