Module:call

Hello, you have come here looking for the meaning of the word Module:call. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:call, but we will also tell you about its etymology, its characteristics and you will know how to say Module:call in singular and plural. Everything you need to know about the word Module:call you have here. The definition of the word Module:call will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:call, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module is for making one template pass all of its arguments to another template. This can be used, for example, to conditionally redirect one template to another. In the future, more sophisticated argument passing will be implemented. For now, the simplest use is as follows:

{{#invoke:call|call|template}}

where template is the template you want to redirect to. For example, deprecated template {{cola}} can redirect all its arguments (which may be arbitrarily many) to {{col}} using:

{{#invoke:call|call|col}}

Unfortunately, due to the nature of templates, there is no way to wrap this module invocation in a {{call}} template or similar; the redirecting template must directly invoke the module.


local export = {}

function export.call(frame)
	local frame_args = frame.args
	local parent_args = frame:getParent().args
	local args = {}
	local template = frame_args
	for k, v in pairs(parent_args) do
		args = v
	end
	for k, v in pairs(frame_args) do
		if k == 1 then
		elseif type(k) == "number" then
			args = v
		else
			args = v
		end
	end
	return frame:expandTemplate{title = template, args = args}
end

return export

-- For Vim, so we get 4-space tabs
-- vim: set ts=4 sw=4 noet: