Module:SpriteFile: Difference between revisions

No edit summary
Tag: Reverted
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 52: Line 52:
local name = args.name or ''
local name = args.name or ''
local nameVanilla = args.nameVanilla or name
if name == 'InvSprite' then
if name == 'InvSprite' then
name = 'Invicon'
name = 'Invicon'
end
if nameVanilla == 'InvSprite' then
nameVanilla = 'Invicon'
end
end
local file = ''
local file = ''
if mod == 'Minecraft' or mod == 'minecraft' then
if mod == 'Minecraft' or mod == 'minecraft' then
file = name .. ' ' .. nameId .. '.png'
file = nameVanilla .. ' ' .. nameId .. '.png'
else
else
file = name .. mod .. ' ' .. nameId .. '.png'
file = name .. ' ' .. mod .. ' ' .. nameId .. '.png'
end
end
Line 128: Line 132:
local text
local text
if not args.notext then
if not args.notext then
text = args.text or args[2] or link
text = args.text or args[2] or ''
--local mod = link:match( '([^:%]]+):' ) or "Minecraft"
if text == '' then
local nameStart = ( link:find( ':' ) or link:find( '%]' ) or 0 ) + 1
local nameStart = (link:find( ':' ) or 0 ) + 1
if nameStart - 1 == #link then
if nameStart - 1 == #link then
nameStart = 1
nameStart = 1
end
text = link:sub( nameStart, ( link:find( '[,%[]', nameStart ) or 0 ) - 1 )
end
end
text = text:sub( nameStart, ( text:find( '[,%[]', nameStart ) or 0 ) - 1 )
end
end