Editing Module:ParamtestGive feedback
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 1: | Line 1: | ||
-- | -- | ||
-- Tests basic properties of parameters | -- Tests basic properties of parameters | ||
| Line 27: | Line 10: | ||
function p.is_empty(arg) | function p.is_empty(arg) | ||
return not | return not arg or not arg:find('%S') | ||
end | end | ||
| Line 34: | Line 17: | ||
-- | -- | ||
function p.default_to( | function p.default_to(param, default) | ||
if | if param and param:find('%S') then | ||
return | return param | ||
else | else | ||
return default | return default | ||
| Line 48: | Line 31: | ||
local ret = {} | local ret = {} | ||
for i, v in ipairs(...) do | for i, v in ipairs(...) do | ||
if | if v[1] and v[1]:find('%S') then | ||
table.insert(ret,v[1]) | table.insert(ret,v[1]) | ||
else | else | ||
| Line 64: | Line 47: | ||
function p.has_content(arg) | function p.has_content(arg) | ||
return | return arg and arg:find('%S') | ||
end | end | ||