Module:EncounterTableSandbox: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
Line 94: Line 94:
     local footer = tablefooter or {}
     local footer = tablefooter or {}
     for i, entry in ipairs(final) do
     for _, entry in ipairs(final) do
         tableRows[i] = ('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>'):format(entry.item, entry.quantity, entry.weight, entry.chance)
         tableRows.insert(('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>'):format(entry.item, entry.quantity, entry.weight, entry.chance))
     end
     end
if #footer > 0 then
if #footer > 0 then
tableRows[#tableRows+1] = ('<tr><td colspan="3">%s</td><td>%s</td></tr>'):format(footer.item, footer.chance)
tableRows.insert(('<tr><td colspan="3">%s</td><td>%s</td></tr>'):format(footer.item, footer.chance))
end
end
     return ('<table class="wikitable sortable">%s%s</table>'):format(TABLE_HEADER, table.concat(tableRows, ''))
     return ('<table class="wikitable sortable">%s%s</table>'):format(TABLE_HEADER, table.concat(tableRows, ''))