Module:Test Criteria

From Arknights Terra Wiki
Jump to navigation Jump to search

The Lua source code for the display of Test Criteria in Pinch-Out Experimental Operation and Contingency Contract Battleplans through {{Test Criteria}}.


local p = {}
local data = mw.loadData('Module:Test Criteria/data')
local getArgs = require('Module:Arguments').getArgs
function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end
function p._main(args)
	local display = args.display or 'default'
	local name = args[1]
	local alt = args[2]
	local val = data[name]
	if type(val) == 'table' then
    	filename = val[alt]
	else
    	filename = val
	end
	local effect = args.effect or ''
	local wrapper = mw.html.create('')
	if display == 'template' then
		return '<div style="display:inline-block; margin:5px; position:relative; text-align:center;">[[File:Test Criteria-'..filename..'.png|40x40px|link=]]</div>'
	elseif display == 'default' then
		return '<span title="'..effect..'" style="display:inline-block;">[[File:Test Criteria-'..filename..'.png|20x20px|link=]]&#32;'..name..'</span>'
	end
end
return p