跳转到内容

模組:Class

被永久保护的模块
维基百科,自由的百科全书

这是本页的一个历史版本,由風中的刀劍留言 | 贡献2015年7月25日 (六) 04:11编辑。这可能和当前版本存在着巨大的差异。

require('Module:No globals')

local class = mw.loadData('Module:Class/data')

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)
	-- Main module code goes here.
		local input = string.lower(args.color)
	
	for _, v in ipairs(class) do
		if input == v.code then
			return v.color
		elseif input == v.name then
			return v.color
		else
			for _, w in ipairs(v.alias) do
				if input == w then
					return '<nowiki>' .. w .. '</nowiki>'
				end
			end
		end
	end

	return '<nowiki>' .. class[#class].color .. '</nowiki>'
end

return p