Module:Inventory slot: Difference between revisions
m I obviously haven't used lua in a while... |
Allow specifying file extension, to use file directly, rather than with Grid prefix and PNG only. |
||
| Line 111: | Line 111: | ||
elseif ids[name] then | elseif ids[name] then | ||
idData = ids[name] | idData = ids[name] | ||
elseif name:match( '\.gif$' ) or name:match( '\.png$' ) then | |||
img = name | |||
name = name:sub( 0, -5 ) | |||
else | else | ||
img = name | img = 'Grid ' .. name .. '.png' | ||
end | end | ||
| Line 165: | Line 168: | ||
local escapedTitle = ( plainTitle or '' ):gsub( '&', '&' ) | local escapedTitle = ( plainTitle or '' ):gsub( '&', '&' ) | ||
item:addClass( 'invslot-item-image' ) | item:addClass( 'invslot-item-image' ) | ||
:wikitext( '[[File: | :wikitext( '[[File:', img, '|32x32px|link=', link or '', '|', escapedTitle, ']]' ) | ||
else | else | ||
if not sprite then | if not sprite then | ||