跳转到内容

模組:VG NFC category handle

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

这是本页的一个历史版本,由Xiplus-abot留言 | 贡献2020年6月23日 (二) 00:36 (已保护“Module:VG NFC category handle”:高風險模板:2330引用<!-- 機器人3 -->([编辑=仅允许自动确认用户](无限期)[移动=仅允许自动确认用户](无限期)))编辑。这可能和当前版本存在着巨大的差异。

require('Module:No globals')

local platformAlias = {
	-- Nintendo
	['红白机'] = {'红白机', '紅白機', 'FC', 'Famicom', 'NES', 'Nintendo Entertainment System', 'FC磁碟机', 'FC磁碟機'},
	['超级任天堂'] = {'超级任天堂',  '超級任天堂', '超任', 'SFC', 'Super Famicom', 'SNES'},
	['任天堂64'] = {'任天堂64', 'N64'},
	['任天堂GameCube'] = {'任天堂GameCube', 'GameCube', 'NGC'},
	['Wii'] = {'Wii'},
	['Wii U'] = {'Wii ?U'},
	['任天堂Switch'] = {'任天堂Switch', 'Nintendo Switch', 'NS'},
	['Game Boy'] = {'Game ?Boy', 'GB'},
	['Game Boy Color'] = {'Game Boy Color', 'GBC'},
	['Game Boy Advance'] = {'Game Boy Advance', 'GBA'},
	['任天堂DS'] = {'任天堂DS', 'Nintendo DS', 'NDS'},
	['任天堂3DS'] = {'任天堂3DS', 'Nintendo 3DS', 'N3DS', '3DS'},
	
	-- Sony
	['PlayStation (游戏机)'] = {'PlayStation %(游戏机%)', 'PlayStation %(遊戲機%)', 'PlayStation', 'PS1'},
	['PlayStation 2'] = {'PlayStation 2', 'PS2'},
	['PlayStation 3'] = {'PlayStation 3', 'PS3'},
	['PlayStation 4'] = {'PlayStation 4', 'PS4'},
	['PlayStation Portable'] = {'PlayStation Portable', 'PSP'},
	['PlayStation Vita'] = {'PlayStation Vita', 'PSV', 'PSVita'},
	
	-- Microsoft
	['Xbox'] = {'Xbox %(游戏机%)', 'Xbox %(遊戲機%)', 'Xbox'},
	['Xbox 360'] = {'Xbox? 360', 'X360'},
	['Xbox One'] = {'Xbox? One', 'XOne'},
	
	-- Sega
	['世嘉Master System'] = {'世嘉Master System', 'Sega Master System', 'Master System', 'SMS'},
	['Mega Drive'] = {'Mega ?Drive', 'MD', 'Sega Genesis'},
	['世嘉土星'] = {'世嘉土星', 'Sega Saturn', 'SS'},
	['Dreamcast'] = {'Dreamcast'},
	
	-- Computer
	['Windows'] = {'Windows', 'Microsoft Windows'},
	['MacOS'] = {'macOS', 'Mac OS X', 'OS X'},
	['日本成人游戏'] = {'日本成人游戏', '日本成人遊戲', '十八禁'},

	-- Other
	['街机'] = {'街机', '街機', '大型電玩', 'Arcade'},

}


local getArgs = require('Module:Arguments').getArgs
local p = {}

local function returnCategory(input, property)
	for categoryName, aliases in pairs(platformAlias) do
		for _, k in ipairs(aliases) do
			if string.find(input, '^' .. k .. '$') then
				return '[[Category:' .. categoryName .. property .. ']]'
			end
		end
	end

	return '[[Category:' .. input .. property .. ']]'
	
end

function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end

function p._main(args)
	-- Main module code goes here.
	local tab = {}
	for i = 1, 10 do
		if args[i] then
			table.insert(tab, returnCategory(args[i], args.property))
		end
	end
	if table.maxn(tab) == 0 then
		return returnCategory('电子', args.property)
	end
	return table.concat(tab)
end

return p