Module:Unit/GearList

local p = {}

local render_gear_icon = require('Module:Render/Gear')._icon local model   = require('Module:Data').model

local gearData = function(iname) local data = model.query('Artifact','_pageName,server,rini,icon',{where='iname="'..iname..'"'}) return data[1] end

function p.relatedGearList(frame) local args = require('Module:Arguments').getArgs(frame, {parentFirst = true}) local iname = args[1] return p._relatedGearList(iname) end

function p._relatedGearList(iname) if iname == nil then return 'Invalid parameter' end local data = mw.loadData("Module:Data/Extra/UnitGearList") local gearList = data[iname] if not gearList then return '' end

local output = {} for index, entry in pairs( gearList ) do       local gear = gearData(entry) if gear then table.insert(output, render_gear_icon({entry, data=gear, size=64})) end end return ('== Related Gears ==\n\n '..table.concat(output, ' ')..' ') end

return p