Module:Sprite: Difference between revisions

Jump to navigation Jump to search
Removed bug that resulted in using the wrong sprite if the name was unkown and setPosition calculating the right position and changing the css accordingly but storing it wrong internaly (of by 1)
(Was confused by local scope)
(Removed bug that resulted in using the wrong sprite if the name was unkown and setPosition calculating the right position and changing the css accordingly but storing it wrong internaly (of by 1))
Line 69: Line 69:
local sprite = {}
local sprite = {}
setmetatable(sprite, {__index = self})
setmetatable(sprite, {__index = self})
local settings = {}
setmetatable(settings, {__index = self.__settings})
sprite.__settings = settings
return sprite:setItem(item)
return sprite:setItem(item)
end
end
Line 81: Line 84:
self.__styles["background-position"] = '-' .. left .. 'px -' .. top .. 'px'
self.__styles["background-position"] = '-' .. left .. 'px -' .. top .. 'px'


settings.pos = pos
settings.pos = pos + 1
return self
return self
end
end
Bureaucrats, emailconfirmed, Interface administrators, staff, Administrators, translation-admin, translator, Widget editors
154

edits

Navigation menu