Module:Sprite: Difference between revisions

Jump to navigation Jump to search
Better nil check
m (It's far too late, I'm tired and really should stop making edits.)
(Better nil check)
Line 149: Line 149:
elseif aliases[item].name then
elseif aliases[item].name then
self.__settings.title = aliases[item].name
self.__settings.title = aliases[item].name
end
if aliases[item].name ~= nil then
local itemName = aliases[item].name
self:setPosition(self.__source.ids[itemName].pos)
if self.__source.ids[itemName].spriteSheet then
self.__settings.image = getSpriteSheet(self.__source.ids[itemName].spriteSheet)
end
end
end
     else
     else
         self.__settings.title = item;
         self.__settings.title = item;
end
 
if self.__source.ids[item] then
if aliases[item].name ~= nil then
self:setPosition(self.__source.ids[item].pos)
local itemName = aliases[item].name
if self.__source.ids[item].spriteSheet then
self:setPosition(self.__source.ids[itemName].pos)
            self.__settings.image = getSpriteSheet(self.__source.ids[item].spriteSheet)
if self.__source.ids[itemName].spriteSheet then
        end
self.__settings.image = getSpriteSheet(self.__source.ids[itemName].spriteSheet)
else
self:setPosition(nil) --will use default
end
end
elseif self.__source.ids[item] then
self:setPosition(self.__source.ids[item].pos)
        if self.__source.ids[item].spriteSheet then
            self.__settings.image = getSpriteSheet(self.__source.ids[item].spriteSheet)
        end
else
self:setPosition(nil) --will use default
end
end
return self
return self
end
end
Bureaucrats, Check users, emailconfirmed, Interface administrators, staff, Administrators, translation-admin, Widget editors
1,659

edits

Navigation menu