Module:Inventory slot/Aliases: Difference between revisions

No edit summary
god i was drunk
Line 740: Line 740:
-- Parse ${,} (world-select) syntax
-- Parse ${,} (world-select) syntax
local selector = (woodTypeWorld[wood] == 'overworld') and "%1" or "%2"
local selector = (woodTypeWorld[wood] == 'overworld') and "%1" or "%2"
-- FIXME: It's not taking the selector! https://stackoverflow.com/questions/61981552
itemName = realItem:gsub("%${(.-),(.-)}", selector)
realItem = realItem:gsub("%${(.-),(.-)}", selector)


if realItem:find('%$wood') then
if realItem:find('%$wood') then
itemName = realItem:gsub('%$wood', wood)
itemName = itemName:gsub('%$wood', wood)
elseif realItem:find('%$1') then
elseif realItem:find('%$1') then
itemName = realItem:gsub( '%$1', wood)
itemName = itemName:gsub( '%$1', wood)
else
else
itemName = wood .. ' ' .. realItem
itemName = wood .. ' ' .. itemName
end
end
table.insert(woodAliases, itemName)
table.insert(woodAliases, itemName)