Module:Sandbox: Difference between revisions
From HorizonXI Wiki
Starfox9507 (talk | contribs) (Created page with "--[[ {{Helper module |name=Paramtest |fname1 = is_empty(arg) |ftype1 = String |fuse1 = Returns true if arg is not defined or contains only whitespace |fname2 = has_content(arg) |ftype2 = String |fuse2 = Returns true if arg exists and does not only contain whitespace |fname3 = default_to(arg1,arg2) |ftype3 = String, Any value |fuse3 = If arg1 exists and does not only contain whitespace, the function returns arg1, otherwise returns arg2 |fname4 = defaults{ {arg1,arg2},...}...") |
Starfox9507 (talk | contribs) (Replaced content with "local getArgs = require('Module:Arguments').getArgs local p = {} function p.main(frame) local args = getArgs(frame) return p._main(args) end function p._main(args) local first = args[1] or '' local second = args[2] or '' return first .. ' ' .. second end return p") Tag: Replaced |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
local getArgs = require('Module:Arguments').getArgs | |||
local | |||
local p = {} | local p = {} | ||
function p.main(frame) | |||
local args = getArgs(frame) | |||
return p._main(args) | |||
function p. | |||
end | end | ||
function p._main(args) | |||
local first = args[1] or '' | |||
local second = args[2] or '' | |||
function p. | return first .. ' ' .. second | ||
local | |||
end | end | ||
return p | return p |
Latest revision as of 13:45, 24 September 2023
Documentation for this module may be created at Module:Sandbox/doc
local getArgs = require('Module:Arguments').getArgs local p = {} function p.main(frame) local args = getArgs(frame) return p._main(args) end function p._main(args) local first = args[1] or '' local second = args[2] or '' return first .. ' ' .. second end return p