မာတိကာသို့ ခုန်သွားရန်

မဝ်ဂျူ:WOTD

နူ ဝိက်ရှေန်နရဳ

Documentation for this module may be created at မဝ်ဂျူ:WOTD/doc

local export = {}

local function call_or_print_error(func)
	return xpcall(func, function(err)
		mw.log(tostring(err), "\n", debug.traceback(), "\n")
	end)
end

function export.check_pages(frame)
	local ok, res = call_or_print_error(function()
		local format = assert(frame.args.format, "Format parameter not supplied")
		for _, file in ipairs(frame.args) do
			local page = mw.title.new(file)
			if page.file and page.file.exists then
				return format:format(file)
			end
		end
	end)
	if ok then
		return res
	end
end

return export