Module:If any equal

From The Right Wiki
Jump to navigationJump to search

Usage

This module checks all positional parameters to see if any of them is equal to the parameter "value". If so, it will output "yes", otherwise "no".

Examples

  • {{#invoke:If any equal|main|a|b|c|d|value=c}} gives yes
  • {{#invoke:If any equal|main|a|b|c|d|value=r}} gives no
  • {{#invoke:If any equal|main|a|b|c|d|value=}} gives no

require('strict')
local p = {}
p.main = function(frame)
local match = false
for name, value in pairs(frame.args) do
if type(name)=='number' and value:lower()==frame.args.value:lower() then
match = true
break
end
end
return match and 'yes' or 'no'
end
return p