Module:Arguments/doc
Jump to navigation
Jump to search
This is the documentation page for Module:Arguments
| This page was originally sporked from Wikipedia. Source(s): w:Module:Arguments |
This module provides easy processing of arguments passed from #invoke. It is a meta-module, meant for use by other modules, and should not be called from #invoke directly (for a module directly invocable by templates you might want to have a look at params). Its features include:
- Easy trimming of arguments and removal of blank arguments.
- Arguments can be passed by both the current frame and by the parent frame at the same time. (More details below.)
- Arguments can be passed in directly from another Lua module or from the debug console.
- Most features can be customized.
Basic use
First, you need to load the module. It contains one function, named getArgs.
local getArgs = require('Module:Arguments').getArgs
In the most basic scenario, you can use getArgs inside your main function. The variable args is a table containing the arguments from #invoke.
local getArgs = require('Module:Arguments').getArgs
local p = {}
function p.main(frame)
local args = getArgs(frame)
-- Main module code goes here.
end
return p