Module:Clickpic: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 4: | Line 4: | ||
local pics = { | local pics = { | ||
gem = {image='Gemini Icon',link='Gemini Station'}, | |||
earth = {image='Earth Icon',link='Earth'}, | |||
mars = {image='Mars Icon',link='Mars'}, | |||
jupiter = {image='Jupiter Icon',link='Jupiter'}, | |||
eris = {image='Eris Icon',link='Eris'}, | |||
mercury = {image='Mercury Icon',link='Mercury'} | |||
} | } | ||
| Line 25: | Line 25: | ||
file = pics[skill:lower()] | file = pics[skill:lower()] | ||
else | else | ||
file = pics. | file = pics.earth | ||
end | end | ||
local ret = '[[File:'..file.image..'.png|21x21px|link='..(file.link or '')..'|alt='..(file.link or '')..']]' | local ret = '[[File:'..file.image..'.png|21x21px|link='..(file.link or '')..'|alt='..(file.link or '')..']]' | ||
if level then | |||
ret = level..' '..ret | |||
end | |||
return ret | return ret | ||
Latest revision as of 21:24, 28 January 2021
Module documentation
This documentation is transcluded from Module:Clickpic/doc. [edit] [purge]
Module:Clickpic's function main is invoked by Template:Clickpic.
Place {{No documentation}} at the top of the documentation page.
This template should be used when there is no documentation for a Module. The template will attempt to auto detect and link the require()/mw.loadData() depedency list. If you want to supress the auto generated dependency list, use {{No documentation|DependencyList=no}}
-- <pre>
local p = {}
local pics = {
gem = {image='Gemini Icon',link='Gemini Station'},
earth = {image='Earth Icon',link='Earth'},
mars = {image='Mars Icon',link='Mars'},
jupiter = {image='Jupiter Icon',link='Jupiter'},
eris = {image='Eris Icon',link='Eris'},
mercury = {image='Mercury Icon',link='Mercury'}
}
function p.main(frame)
local args = frame:getParent().args
local skill = args[1] or ''
local level = args[2]
return p._main(skill, level)
end
function p._main(skill, level)
local file
if type(skill) == 'string' and pics[skill:lower()] then
file = pics[skill:lower()]
else
file = pics.earth
end
local ret = '[[File:'..file.image..'.png|21x21px|link='..(file.link or '')..'|alt='..(file.link or '')..']]'
if level then
ret = level..' '..ret
end
return ret
end
return p