Module:Race

local p = {} local races = {}

function p.findIndex(search) for i, race in ipairs(races) do		if (string.lower(string.gsub(race.link,'%s','')) == search) then return i		end end for i, race in ipairs(races) do		for j, alt in ipairs(race.alternates) do			if (string.lower(string.gsub(alt,'%s','')) == search) then return i			end end end for i, race in ipairs(races) do		if (string.lower(string.gsub(race.name,'%s','')) == search) then return i		end end return -1 end

function p.main(frame) races = mw.loadData('Module:Race/data') local search = string.lower(string.gsub(frame:getParent.args[1],'%s','')) local index = p.findIndex(search) local output = '' local size = frame:getParent.args["size"] or '16px' if index == -1 then return output else if size == '32px' then output = output .. '' end local race = races[index] for i, img in ipairs(race.images) do output = output .. ''	end if size == '32px' then output = output .. ' '	else output = output .. ' '	end local text = frame:getParent.args[2] or  .. race.name ..  if text ~= 'notext' then output = output .. ' ' .. text end if size == '32px' then output = output .. ' '	end return output end

return p