Module:Crafting: Difference between revisions

No edit summary
No edit summary
Line 141: Line 141:
--local name = item.mod .. ":" .. item.name    -- use instead of just item.name if mods are covered
--local name = item.mod .. ":" .. item.name    -- use instead of just item.name if mods are covered
if not usedNames[item.name] then
local gifflessname = item.name:gsub("%.gif$", "")
table.insert(retTable, item.name)
table.insert(inputRetTable, item.name)
if not usedNames[gifflessname] then
usedNames[item.name] = true
table.insert(retTable, gifflessname)
table.insert(inputRetTable, gifflessname)
usedNames[gifflessname] = true
if aliases[item.name] then
if aliases[gifflessname] then
for _, aliasEntry in ipairs(aliases[item.name]) do
for _, aliasEntry in ipairs(aliases[item.name]) do
if not usedNames[aliasEntry] then
table.insert(retTable, (aliasEntry.name or aliasEntry)) -- Sometimes the alias entry is a table, so try and grab its name from within the table with a fallback to just the entry.
local aliasName = (aliasEntry.name or aliasEntry):gsub("%.gif$", "")
if not usedNames[aliasName] then
table.insert(retTable, aliasName) -- Sometimes the alias entry is a table, so try and grab its name from within the table with a fallback to just the entry.
usedNames[aliasEntry] = true
usedNames[aliasEntry] = true
end
end
Line 165: Line 169:
if args.group then
if args.group then
for name in string.gmatch(args.group, "[^,]+") do
for name in string.gmatch(args.group, "[^,]+") do
table.insert(group_names, mw.text.trim(name):gsub('%.gif$', ''))
table.insert(group_names, mw.text.trim(name))
end
end
end
end