[checked revision] | [checked revision] |
m (Protected "Module:Champion" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))) |
(finalExtends) |
||
(43 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
⚫ | |||
− | local p = {} |
||
+ | p.objectType = 'Champion' |
||
⚫ | |||
+ | p.cssClass = 'champion-object' |
||
− | local args = frame |
||
+ | p.defaultlength = 'display' |
||
− | if frame == mw.getCurrentFrame() then |
||
+ | p.imagelength = 'link' |
||
− | args = require( 'Module:ProcessArgs' ).merge( true ) |
||
+ | p.filePattern = '%sSquare.png' |
||
− | else |
||
+ | p.imagesizes = { default = 25, display = 25, inline = 20, } |
||
− | frame = mw.getCurrentFrame() |
||
+ | |||
− | end |
||
⚫ | |||
− | |||
+ | if not opts then opts = {} end |
||
⚫ | |||
+ | return opts.display or self:get(opts.len or self.defaultlength) |
||
− | local Names = mw.loadData( 'Module:Championnames' ) |
||
− | |||
− | local input = args[1] or 'Unknown' |
||
− | local inputlc = string.lower(input) |
||
− | local style = string.lower(args[2] or 'default') |
||
− | |||
− | local link = Names[inputlc] or input |
||
− | local display = args.display or link |
||
− | |||
− | if args.size then |
||
− | if string.sub(args.size,-2) == "px" then |
||
− | args.size = string.sub(args.size,1,-3) |
||
− | end |
||
− | end |
||
− | |||
− | local text = Styles[style](link, display, args['size']) |
||
− | |||
− | return text |
||
end |
end |
||
Revision as of 05:40, 24 August 2020
Edit the documentation or categories for this module.
If you are an editor wanting to update the list of champions, see {{Championnames}}m
local p = require('Module:EntityAbstract'):finalExtends()
p.objectType = 'Champion'
p.cssClass = 'champion-object'
p.defaultlength = 'display'
p.imagelength = 'link'
p.filePattern = '%sSquare.png'
p.imagesizes = { default = 25, display = 25, inline = 20, }
function p:name(opts)
if not opts then opts = {} end
return opts.display or self:get(opts.len or self.defaultlength)
end
return p