Editing Module:IconUtils
From Eco - English Wiki
Your changes will be displayed to readers once an authorized user accepts them. (help)
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 2: | Line 2: | ||
function p.main(param) | function p.main(param) | ||
local Utils = require('Module:Utils') | |||
local itemData = mw.loadData("Module:ItemData") | |||
local Icon = '' | |||
local args = Utils.normaliseArgs(param) | local args = Utils.normaliseArgs(param) | ||
if args.name == nil or args.name == '' then return '\'name\' must be specified.' end | if args.name == nil or args.name == '' then return '\'name\' must be specified.' end | ||
local itemTable = itemData.items[args.name] | local itemTable = itemData.items[args.name] | ||
if itemTable == nil then return args.name .. ' could not be found ' end | if itemTable == nil then return args.name .. ' could not be found ' end | ||
if args.size == nil or args.size == '' then IconSize = 28 else IconSize = args.size end | |||
local ItemEN = itemTable.untranslated | |||
local IconName = string.gsub(ItemEN, ' ', '') .. 'Item' | |||
Icon = Utils.checkImage(IconName) | |||
return '[[file:'.. Icon ..'|'.. IconSize ..px'|link=]]' | |||
end | end | ||
return p | return p |