Module:WOTD
Jump to navigation
Jump to search
- The following documentation is located at Module:WOTD/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
Contains a function used in T:WOTD to find which of several possible English audio files exists and create a file link to it.
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