Module:Arguments
From ARMS Institute, the ARMS Wiki
This module is used to normalise arguments. It removes white space at the beginning and end of arguments and removes empty values.
Usage
This module should generally be used in a separate function, to not prevent usage from other modules.
local getArgs = require( 'Module:Arguments' ).main local p = {} function p.main( frame ) local args = getArgs() return p._main( args ) end function p._main( args ) -- The actual function end return p
local p = {} function p.main( old_args ) if type( old_args ) ~= 'table' then old_args = mw.getCurrentFrame():getParent().args end local args = {} for k, v in pairs( old_args ) do v = mw.text.trim( tostring( v ) ) if v ~= '' then args[k] = v end end return args end return p