Module:Sprite: Difference between revisions

Jump to navigation Jump to search
move alias check to Sprite:Item and Sprite:setItem (double alias attempt #3)
(add else? maybe it set it once and wouldn't set it back? IDK (double alias attempt #2))
(move alias check to Sprite:Item and Sprite:setItem (double alias attempt #3))
Line 4: Line 4:


local aliasData = {
local aliasData = {
vanillaAliases = [[Module:InventorySlot/Aliases]],
minecraft = [[Module:InventorySlot/Aliases]],
gm4Aliases = [[Module:Gm4Sprite/Aliases]]
gm4 = [[Module:Gm4Sprite/Aliases]]
}
}


Sprite.aliasData = aliasData
Sprite.aliasData = aliasData
local vanillaAliases = mw.loadData( aliasData.vanillaAliases )
local gm4Aliases = mw.loadData( aliasData.gm4Aliases )
local aliases


local types = {
local types = {
Line 66: Line 63:
if not(source) then
if not(source) then
error("Unknown type: " .. tostring(type))
error("Unknown type: " .. tostring(type))
end
if tostring(type) == "gm4" then
aliases = gm4Aliases
    else
        aliases = vanillaAliases
end
end


Line 130: Line 121:
end
end


function Sprite:setItem(item)
function Sprite:setItem(item, type)
    -- load correct aliases
    local aliases = mwLoadData( aliasData.type )
-- js-less plaintext title
-- js-less plaintext title
self.__settings.name = item
self.__settings.name = item
Line 162: Line 155:
end
end


function Sprite:Item(item)
function Sprite:Item(item, type)
local sprite = {}
local sprite = {}
setmetatable(sprite, {__index = self})
setmetatable(sprite, {__index = self})
Line 168: Line 161:
setmetatable(settings, {__index = self.__settings})
setmetatable(settings, {__index = self.__settings})
sprite.__settings = settings
sprite.__settings = settings
return sprite:setItem(item)
return sprite:setItem(item, type)
end
end


Bureaucrats, emailconfirmed, Interface administrators, staff, Administrators, translation-admin, translator
2,564

edits

Navigation menu