Jump to content

Module:See also if exists and Module:See also if exists/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
Content deleted Content added
Fix
 
No edit summary
 
Line 3: Line 3:
local p = {}
local p = {}
local yesno = require("Module:yesno")
local yesno = require("Module:yesno")

local function exists(title)
local success, result = pcall(function() return title.exists end)
if success then
return result
else
return true
end
end
function p.main(frame)
function p.main(frame)
local rawpages = {}
local rawpages = {}
Line 20: Line 13:
if (thisArg ~= "") then
if (thisArg ~= "") then
local title = mw.title.new(thisArg, namespace)
local title = mw.title.new(thisArg, namespace)
if title ~= nil and exists(title) then
if title ~= nil and title.exists then
table.insert(rawpages, title.fullText)
table.insert(rawpages, title.fullText)
nvalid = nvalid + 1
nvalid = nvalid + 1