Module:Items/UseTables: Difference between revisions

Added an Items column to the spell uses table when necessary
(Fix various issues)
(Added an Items column to the spell uses table when necessary)
Line 659: Line 659:
if Shared.tableIsEmpty(spellList) then
if Shared.tableIsEmpty(spellList) then
return ''
return ''
end
--Adding a check for if the Items column is needed
local hasItems = false
for i, spell in pairs(spellList) do
if Magic._getSpellItems(spell) ~= '' then
hasItems = true
break
end
end
end


Line 666: Line 675:
table.insert(resultPart, '!!Type!!style="width:275px"|Description')
table.insert(resultPart, '!!Type!!style="width:275px"|Description')
table.insert(resultPart, '!!Runes')
table.insert(resultPart, '!!Runes')
if hasItems then
table.insert(resultPart, '!!Items')
end
for i, spell in pairs(spellList) do
for i, spell in pairs(spellList) do
local rowPart = {}
local rowPart = {}
Line 678: Line 692:
table.insert(rowPart, '||style="text-align:center"|')
table.insert(rowPart, '||style="text-align:center"|')
table.insert(rowPart, Magic._getSpellRunes(spell))
table.insert(rowPart, Magic._getSpellRunes(spell))
if hasItems then
table.insert(rowPart, '||style="text-align:right"|')
table.insert(rowPart, Magic._getSpellItems(spell))
end
table.insert(resultPart, table.concat(rowPart))
table.insert(resultPart, table.concat(rowPart))
end
end