模組:LoadPage

被永久保护的模块
维基百科,自由的百科全书
文档图示 模块文档[创建]
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