Module:InventorySlot: Difference between revisions

Jump to navigation Jump to search
add alias check support to UISlot.Decode (double alias attempt #2)
(Made gm4 items easier)
(add alias check support to UISlot.Decode (double alias attempt #2))
(17 intermediate revisions by 3 users not shown)
Line 6: Line 6:
local Sprites = {
local Sprites = {
minecraft = sprite:new("inventory"),
minecraft = sprite:new("inventory"),
gm4 = sprite:new("gm4")
gm4 = sprite:new("gm4"),
effect = sprite:new("effect")
}
}


Line 26: Line 27:
end
end


self.__sprite = UISlot.Decode(item)




Line 33: Line 35:


function UISlot.Decode(item)
function UISlot.Decode(item)
if not(item) then return nil end
item = mw.text.trim(item)
if item == "" then item = nil end
if item == "" then item = nil end
if item then
if item then
Line 41: Line 45:
end
end
if #t == 1 then
if #t == 1 then
return Sprites.minecraft:Item(item)
return Sprites.minecraft:Item(item,"minecraft")
elseif #t == 2 then
elseif #t == 2 then
local spr = Sprites[mw.text.trim(t[1])]
local spr = Sprites[mw.text.trim(t[1])]
if spr then
if spr then
return spr:Item(mw.text.trim(t[2]))
return spr:Item(mw.text.trim(t[2]), mw.text.trim(t[1]))
else
else
error("Unknown namespace: " .. mw.text.trim(t[1]))
error("Unknown namespace: " .. mw.text.trim(t[1]))
Bureaucrats, emailconfirmed, Interface administrators, staff, Administrators, translation-admin, translator
2,563

edits

Navigation menu