Jump to content

Module:If any equal/sandbox

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by MSGJ (talk | contribs) at 11:42, 6 January 2025 (check not blank). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
require('strict')
local p = {}

p.main = function(frame)
	local check_value = function(value)
		for n, v in pairs(frame.args) do
			if type(n)=='number' and v:lower()==value:lower() then
				return true
			end
		end
	end
	local match = false
	if frame.args.value and frame.args.value~='' then
		match = check_value(frame.args.value)
	elseif frame.args.values and frame.args.values~='' then
		local match = false
		for value in mw.text.gsplit(frame.args.values, "%s*,%s*") do
			match = check_value(value)
			if match then
				break
			end
		end
	end
	return match  and 'yes' or 'no'
end

return p