Jump to content

Module:MakeInvokeFunc

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Awesome Aasim (talk | contribs) at 19:19, 10 April 2024. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- Based on work in [[Module:Documentation]]
local function makeInvokeFunc(p, funcName)
	return function (frame)
		local args = getArgs(frame, {
			valueFunc = function (key, value)
				if type(value) == 'string' then
					value = value:match('^%s*(.-)%s*$') -- Remove whitespace.
					if key == 'heading' or value ~= '' then
						return value
					else
						return nil
					end
				else
					return value
				end
			end
		})
		return p[funcName](args)
	end
end

return makeInvokeFunc