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

-- <nowiki>
local p = {}
local getArgs = require('Dev:Arguments').getArgs
local data = mw.loadData('Module:Icon/data')

-- Implements {{Icon|1=game|2=category|3=icon}}
function p.main(frame)
    local args = getArgs(frame)
    local game = assert(args.game or args[1], 'Game icons not found')
    local category = assert(args.category or args[2], 'Category not found')
    local icon = assert(args.icon or args[3], 'Icon not found')

    if not (game or category or icon) then
        return
    end

    local tmp = data[game:lower()][category:lower()][icon:lower()]
    
    local file = '[[File:' .. tmp.file .. '|alt=' .. tmp.name .. '|20px|link=' .. (tmp.link or '') .. ']]'
    local link = ''
    if tmp.link and not (args[4] == 'nolink') then
        link = ' [[' .. tmp.link .. '|' .. tmp.name .. ']]'
    end

    return file .. link
end

return p
-- </nowiki>
Community content is available under CC-BY-SA unless otherwise noted.