This documentation is transcluded from Module:ItemPorts/doc. Changes can be proposed in the talk page.
Module:ItemPorts is shared across the Star Citizen Wikis.
This module is shared across the Star Citizen Wikis. Any changes should also be relayed to the GitHub repository.
Module:ItemPorts loads configuration from Module:ItemPorts/config.json.
This module can be configurated from the config.json subpage.
Module:ItemPorts loads messages from Module:ItemPorts/i18n.json.
This module is designed to be language-neutral. All of the messages are saved in the i18n.json subpage.
This module is unused.
This module is neither invoked by a template nor required/loaded by another module. If this is in error, make sure to add
{{Documentation}}
/{{No documentation}}
to the calling template's or parent's module documentation.Function list |
---|
L 15 — makeSmwQueryObject L 39 — methodtable.getSmwData L 59 — methodtable.out L 67 — ItemPorts.new L 79 — ItemPorts.outputTable |
require( 'strict' )
local ItemPorts = {}
local metatable = {}
local methodtable = {}
metatable.__index = methodtable
--- Creates the object that is used to query the SMW store
---
--- @param page string the vehicle page containing data
--- @return table
local function makeSmwQueryObject( page )
return {
mw.ustring.format(
'[[-Has subobject::' .. page .. ']][[%s::+]]',
'Item port name'
),
mw.ustring.format( '?%s#-=name', 'Item port name' ),
mw.ustring.format( '?%s#-=min_size', 'Item port minimum size' ),
mw.ustring.format( '?%s#-=max_size', 'Item port maximum size' ),
mw.ustring.format( '?%s#-=equipped_name', 'Equipped item name' ),
--mw.ustring.format( '?%s#-=equipped_uuid', 'Equipped item UUID' ),
mw.ustring.format(
'sort=%s,%s',
'Item port name',
'Item port maximum size'
),
'order=asc,desc',
'limit=1000'
}
end
--- Queries the SMW Store
--- @return table
function methodtable.getSmwData( self, page )
-- Cache multiple calls
if self.smwData ~= nil then
return self.smwData
end
local smwData = mw.smw.ask( makeSmwQueryObject( page ) )
if smwData == nil or smwData[ 1 ] == nil then
return nil
end
mw.logObject( smwData, 'getSmwData' )
self.smwData = smwData
return self.smwData
end
--- Generates template output
function methodtable.out( self )
local smwData = self:getSmwData( self.page )
end
--- New Instance
---
--- @return table ItemPorts
function ItemPorts.new( self, page )
local instance = {
page = page or nil
}
setmetatable( instance, metatable )
return instance
end
--- Parser call for generating the table
function ItemPorts.outputTable( frame )
local args = require( 'Module:Arguments' ).getArgs( frame )
local page = 'Rattler II Missile'
--local page = args[ 1 ] or mw.title.getCurrentTitle().rootText
local instance = ItemPorts:new( page )
local out = instance:out()
return out
end
return ItemPorts