Module:Inventory slot: Difference between revisions

mNo edit summary
Allow skipping aliases
Line 9: Line 9:
args[1] = mw.text.trim( args[1] or '' )
args[1] = mw.text.trim( args[1] or '' )
-- Comment this next line out if you're not using aliases
if not args.noalias then
local aliases = mw.loadData( 'Module:Grid/Aliases' )
-- Comment this next line out if you're not using aliases
local aliases = mw.loadData( 'Module:Grid/Aliases' )
local modAliases = args.modaliases or ''
if modAliases ~= '' then
local modAliases = args.modaliases or ''
modAliases = mw.loadData( 'Module:' .. modAliases )
if modAliases ~= '' then
else
modAliases = mw.loadData( 'Module:' .. modAliases )
modAliases = nil
else
end
modAliases = nil
end
if aliases or modAliases then
local frames = {}
if aliases or modAliases then
for frame in mw.text.gsplit( args[1], '%s*;%s*' ) do
local frames = {}
local frameParts = p.getParts( frame, args.mod )
for frame in mw.text.gsplit( args[1], '%s*;%s*' ) do
local frameParts = p.getParts( frame, args.mod )
local id = frameParts.name
if frameParts.mod then
local id = frameParts.name
id = frameParts.mod .. ':' .. id
if frameParts.mod then
end
id = frameParts.mod .. ':' .. id
end
local alias
if modAliases and modAliases[id] then
local alias
alias = modAliases[id]
if modAliases and modAliases[id] then
elseif aliases and aliases[id] then
alias = modAliases[id]
alias = aliases[id]
elseif aliases and aliases[id] then
alias = aliases[id]
end
if alias then
table.insert( frames, p.expandAlias( frameParts, alias ) )
else
table.insert( frames, frame )
end
end
end
if alias then
args[1] = table.concat( frames, ';' )
table.insert( frames, p.expandAlias( frameParts, alias ) )
else
table.insert( frames, frame )
end
end
end
args[1] = table.concat( frames, ';' )
end
end