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 17:29, 23 May 2024. 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 match = false
	for pos, value in pairs(frame.args) do
		if type(pos)=='number' and value:lower()==frame.args.value:lower() then
			match = true
			break
		end
	end
	return match and 'yes' or 'no'
end

p.ifAnyEqual = function(frame)
	local parent = frame:getParent()
	if not parent.args then
		return nil
	end
	local match = false
	for name, value in pairs(parent.args) do
		if type(name)=='number' and parent.args[value]:lower()==frame.args.value:lower() then
			match = name
			break
		end
	end
	return match or 'no'
end

return p