Jump to content

Module:Title: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
No edit summary
Line 5: Line 5:
p[k] = function(frame)
p[k] = function(frame)
local args = require("Module:Arguments").getArgs(frame)
local args = require("Module:Arguments").getArgs(frame)
local title = args.title and mw.title.new(args.title) or currentTitle
local title = (args[1] and mw.title.new(args[1])) or (args.title and mw.title.new(args.title)) or currentTitle
return currentTitle[k]
return currentTitle[k]
end
end

Revision as of 19:44, 22 August 2024

local p = {}
local currentTitle = mw.title.getCurrentTitle()

for k,_ in pairs(currentTitle) do
	p[k] = function(frame)
		local args = require("Module:Arguments").getArgs(frame)
		local title = (args[1] and mw.title.new(args[1])) or (args.title and mw.title.new(args.title)) or currentTitle
		return currentTitle[k]
	end
end

return p