Bureaucrats, emailconfirmed, Interface administrators, staff, Administrators, translation-admin, translator
2,564
edits
(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 = { | ||
minecraft = [[Module:InventorySlot/Aliases]], | |||
gm4 = [[Module:Gm4Sprite/Aliases]] | |||
} | } | ||
Sprite.aliasData = aliasData | Sprite.aliasData = aliasData | ||
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 | 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 | ||
edits