Line 13: |
Line 13: |
| -- header = [[{{EliteShipsKaiSortable]], | | -- header = [[{{EliteShipsKaiSortable]], |
| header = [[]], | | header = [[]], |
− | item = [=[%s | + | item = [=[%s]=], |
− | |]=],
| |
| } | | } |
| | | |
Line 30: |
Line 29: |
| if not success then return "No data for ships: " .. itemType end | | if not success then return "No data for ships: " .. itemType end |
| | | |
− | local result = string.format(template.header) | + | local result = { string.format(template.header) } |
| | | |
| local suffix = {} | | local suffix = {} |
Line 39: |
Line 38: |
| end | | end |
| | | |
| + | local first = true |
| if not equipment then | | if not equipment then |
| for k, v in pairs(data) do | | for k, v in pairs(data) do |
Line 49: |
Line 49: |
| end | | end |
| end | | end |
− | result = result .. string.format(template.item, name) | + | if first then table.insert(result, name) first = false |
| + | else table.insert(result, "|" .. name) end |
| end | | end |
| end | | end |
Line 56: |
Line 57: |
| if v.type == itemType then | | if v.type == itemType then |
| local name = v.name[2] | | local name = v.name[2] |
− | result = result .. string.format(template.item, name) | + | if first then table.insert(result, name) first = false |
| + | else table.insert(result, "|" .. name) end |
| end | | end |
| end | | end |
Line 62: |
Line 64: |
| | | |
| for k, v in pairs(notes) do | | for k, v in pairs(notes) do |
− | result = result .. string.format(template.item, v) | + | table.insert(result, "|" .. v) |
| end | | end |
| | | |
| for k, v in pairs(coloring) do | | for k, v in pairs(coloring) do |
− | result = result .. string.format(template.item, v) | + | table.insert(result, "|" .. v) |
| end | | end |
| | | |
− | result = result .. template.footer
| + | -- table.insert(result, template.footer) |
− | return result .. '\n' | + | return table.concat(result, "\n") |
| end | | end |
| | | |
Line 161: |
Line 163: |
| end | | end |
| | | |
− | --return { render = render, test = test } --swap comments to test
| + | return { test = test } --swap comments to test |
− | return ListOfSortable | + | --return ListOfSortable |
| | | |
| -- TEST: p.test() | | -- TEST: p.test() |