@DeletedUser41170185 (talk | contribs) mNo edit summary |
@DeletedUser41170185 (talk | contribs) No edit summary |
||
Line 8: | Line 8: | ||
function p._main( args ) |
function p._main( args ) |
||
local image = 'File:Team icon ' .. args[1] .. '.png' |
local image = 'File:Team icon ' .. args[1] .. '.png' |
||
− | if pcall( p.cargo, args[1], 'icon' ) |
+ | if pcall( p.cargo, args[1], 'icon' ) then |
image = p.cargo( args[1], 'icon' ) |
image = p.cargo( args[1], 'icon' ) |
||
elseif mw.title.new( image ).fileExists == false then |
elseif mw.title.new( image ).fileExists == false then |
Revision as of 18:42, 20 December 2017
▶️
Planeshift.
The documentation for this module can be found at Template:Team icon.
You may be forwarded to another wiki language, in case a translation is not available.
local p = {}
function p.main( frame )
local args = frame:getParent().args
return p._main( args )
end
function p._main( args )
local image = 'File:Team icon ' .. args[1] .. '.png'
if pcall( p.cargo, args[1], 'icon' ) then
image = p.cargo( args[1], 'icon' )
elseif mw.title.new( image ).fileExists == false then
image = 'File:Team icon Default.png'
end
local size = args[2] or '40px'
return '[[' .. image .. '|' .. size .. '|link=' .. args[1] .. ']]'
end
function p.cargo( page, property )
return cargo.query( 'professional_teams', 'CONCAT(' .. property .. ')', { where='_pageName="' .. page .. '"', groupBy='_pageID' } )[1]['CONCAT(' .. property .. ')']
end
return p