Module:Favilink Utility: Difference between revisions

m
Reverted edits by Egocarib (talk) to last revision by Teamtoto
(error only using favilink id)
m (Reverted edits by Egocarib (talk) to last revision by Teamtoto)
Tag: Rollback
 
(3 intermediate revisions by 2 users not shown)
Line 44: Line 44:
if resulttrue == 1 then
if resulttrue == 1 then
if #result > 1 and searchtype == 'ObjectID' then
if #result > 1 and searchtype == 'ObjectID' then
error("There was more than one result with that name![[Category:pages with favilink errors]]")
error("There was more than one result with the name " .. name .. "![[Category:pages with favilink errors]]")
end
end
return result[1]
return result[1]
Line 75: Line 75:
if frame.args ~= nil then
if frame.args ~= nil then
     name = frame.args[1]
     name = frame.args[1]
    overridelink = frame.args[2] and frame.args[2] == "overridelink" or False
end
end
local result = p.main(name, 'ObjectID', '_pageName=Page,PlainName')
local result = p.main(name, 'ObjectID', '_pageName=Page,PlainName')
Line 84: Line 85:
pagename = result['Page']
pagename = result['Page']
plainname = result['PlainName']
plainname = result['PlainName']
if string.lower(plainname) == string.lower(pagename) then
if string.lower(plainname) == string.lower(pagename) or not overridelink then
return pagename
return pagename
end
end