Documentation for this module may be created at Module:Equipment/doc
local p = {} local d = require('Module:Data') local dv = require('Module:Data/View') p.view = {} p.view['Name'] = dv.title{'name'} p.view['Price'] = dv.number{'price', unit='E$'} p.view['Mass'] = dv.number{'mass', unit='kg'} p.view['Manufacturer'] = dv.text{'manufacturer'} -- Projectile magazines, nanodrone components, and propellant tanks p.view['Storage'] = dv.number{'storage', unit='kg'} p.view['Delivery'] = dv.number{'delivery', unit='kg/s'} p.view['Exclusive to'] = dv.list{'exclusiveTo', itemView=dv.title{nil}} -- Ultracapacitors p.view['Energy capacity'] = dv.number{'energyCapacity', unit='MJ'} p.view['Peak power'] = dv.number{'peakPower', unit='GW'} for k,v in pairs(p.view) do v.heading = v.heading or k end p.defaultColumns = { 'Name', 'Price', 'Mass' } p.positionalArgs = function(f) local posArgs = {} for i,posArg in ipairs(f.args) do -- positional arguments don't get trimmed table.insert(posArgs, mw.text.trim(posArg)) end return posArgs end p.list = function(f) local posArgs = p.positionalArgs (f) local slot = table.remove(posArgs, 1) local columns = posArgs if table.getn(columns) == 0 then columns = p.defaultColumns end local data = mw.loadData('Module:Equipment/Data') data = data[slot] data = d.sort(data, { d.on(d.path{'price'}, d.asc), d.on(d.path{'name'}, d.asc), }) local options = { caption = f.args['caption'] } return dv.displayTable(data, p.view, columns, options) end return p