1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 14:11:29 +00:00

Change t['rows'] to t.current_row, because it may not be equal to the

number of rows that are actually in the table (may be one greater).
This commit is contained in:
david
2010-12-30 21:08:21 +00:00
parent 1ee0fae3d1
commit 974d6061b3

View File

@@ -26,7 +26,7 @@ require('strbuf')
function new()
local table ={}
table['rows'] = 1
table.current_row = 1
setmetatable(table, {__tostring=dump})
return table
end
@@ -43,11 +43,11 @@ function add(t, c, v)
assert(type(v) == "string")
-- add a new row if one doesn't exist
if t[t['rows']] == nil then
t[t['rows']] = {}
if t[t.current_row] == nil then
t[t.current_row] = {}
end
t[t['rows']][c] = v
t[t.current_row][c] = v
return true
end
@@ -70,9 +70,9 @@ end
-- @param t The table.
function nextrow(t)
assert(t)
assert(t['rows'])
t[t['rows']] = t[t['rows']] or {}
t['rows'] = t['rows'] + 1
assert(t.current_row)
t[t.current_row] = t[t.current_row] or {}
t.current_row = t.current_row + 1
end
--- Return a formatted string representation of the table.