Add headers to rowS (SSSSSSSSSSSSSSSS) and not individual row
This commit is contained in:
@@ -515,9 +515,9 @@ phoenix_brigade 30 0.1 shielding_basic battle_physicist_basic reinforced_battery
|
||||
assert(rows2[1].Health == rows[1].Health, "Round trip first row Health should match")
|
||||
|
||||
-- Verify headers are preserved
|
||||
assert(rows2[1].Headers ~= nil, "Round trip rows should have Headers field")
|
||||
assert(#rows2[1].Headers == #rows[1].Headers, "Headers should have same number of elements")
|
||||
assert(rows2[1].Headers[1] == rows[1].Headers[1], "First header should match")
|
||||
assert(rows2.Headers ~= nil, "Round trip rows should have Headers field")
|
||||
assert(#rows2.Headers == #rows.Headers, "Headers should have same number of elements")
|
||||
assert(rows2.Headers[1] == rows.Headers[1], "First header should match")
|
||||
end)
|
||||
|
||||
print("\nAll tests completed!")
|
||||
|
||||
@@ -220,9 +220,9 @@ function fromCSV(csv, options)
|
||||
row[headerName] = dataRow[j]
|
||||
end
|
||||
end
|
||||
row.Headers = headers
|
||||
table.insert(rows, row)
|
||||
end
|
||||
rows.Headers = headers
|
||||
return rows, nil
|
||||
end
|
||||
|
||||
@@ -255,9 +255,9 @@ function toCSV(rows, options)
|
||||
local rowStrings = {}
|
||||
|
||||
-- Include headers row if requested and available
|
||||
if includeHeaders and #rows > 0 and rows[1].Headers ~= nil then
|
||||
if includeHeaders and #rows > 0 and rows.Headers ~= nil then
|
||||
local headerStrings = {}
|
||||
for _, header in ipairs(rows[1].Headers) do
|
||||
for _, header in ipairs(rows.Headers) do
|
||||
local headerStr = tostring(header)
|
||||
local needsQuoting = false
|
||||
if
|
||||
|
||||
Reference in New Issue
Block a user