Toggle menu
14
229
69
27.1K
Kenshi Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 05:07, 22 February 2025 by Prd (talk | contribs) (Created page with "local p = {} function p.main(args) local myArgs = mw.getCurrentFrame():getParent().args local myPageName = myArgs[1] local forceFileOnly = myArgs.forcefile -- force File: namespace check only if not myPageName or myPageName == "" then return "" end local myPageTitle = mw.title.makeTitle("", myPageName) if not myPageTitle then error("Invalid page title passed, MediaWiki cannot understand it", 1) end if myPageTitle.exists or not forceFileOnly and myPage...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Implements {{Exist not redirect}}



local p = {}

function p.main(args)
	local myArgs = mw.getCurrentFrame():getParent().args
	local myPageName = myArgs[1]
	local forceFileOnly = myArgs.forcefile -- force File: namespace check only
	
	if not myPageName or myPageName == "" then
		return ""
	end
	
	local myPageTitle = mw.title.makeTitle("", myPageName)
	if not myPageTitle then
		error("Invalid page title passed, MediaWiki cannot understand it", 1)
	end
	if myPageTitle.exists
		or not forceFileOnly and myPageTitle.file and myPageTitle.file.exists
	then
		if not myPageTitle.isRedirect then
			return myArgs[1]
		end
	end
	
	return ""
end

return p