Documentation for this module may be created at Module:FFRK Charicon/doc

local ffrkcharicon = {}
local getArgs = require('Dev:Arguments').getArgs
local data = mw.loadData('Module:FFRK Charicon/data')

function ffrkcharicon.charicon(frame)
	local args = getArgs(frame)
	return ffrkcharicon._charicon(args)
end

local function imageoutput(character)
    -- table or nil result from "data" lookup of string parameter "character" 
    local charname = data[character]
    
    if charname then
        return string.format(
            '[['..'File:%s.png|link=%s|%s|32px]]',
            charname['filename'],
            charname['link'],
            charname['displayname']
        )
    else
        return ''
    end
    
end

function ffrkcharicon._charicon(args)
    local output = {}
    for i, character in ipairs(args) do
        table.insert( output, imageoutput(character) )
    end
    
    return table.concat(output)
end

return ffrkcharicon
Community content is available under CC-BY-SA unless otherwise noted.