mirror of
https://github.com/nmap/nmap.git
synced 2025-12-10 07:11:37 +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:
@@ -26,7 +26,7 @@ require('strbuf')
|
|||||||
function new()
|
function new()
|
||||||
local table ={}
|
local table ={}
|
||||||
|
|
||||||
table['rows'] = 1
|
table.current_row = 1
|
||||||
setmetatable(table, {__tostring=dump})
|
setmetatable(table, {__tostring=dump})
|
||||||
return table
|
return table
|
||||||
end
|
end
|
||||||
@@ -43,11 +43,11 @@ function add(t, c, v)
|
|||||||
assert(type(v) == "string")
|
assert(type(v) == "string")
|
||||||
|
|
||||||
-- add a new row if one doesn't exist
|
-- add a new row if one doesn't exist
|
||||||
if t[t['rows']] == nil then
|
if t[t.current_row] == nil then
|
||||||
t[t['rows']] = {}
|
t[t.current_row] = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
t[t['rows']][c] = v
|
t[t.current_row][c] = v
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -70,9 +70,9 @@ end
|
|||||||
-- @param t The table.
|
-- @param t The table.
|
||||||
function nextrow(t)
|
function nextrow(t)
|
||||||
assert(t)
|
assert(t)
|
||||||
assert(t['rows'])
|
assert(t.current_row)
|
||||||
t[t['rows']] = t[t['rows']] or {}
|
t[t.current_row] = t[t.current_row] or {}
|
||||||
t['rows'] = t['rows'] + 1
|
t.current_row = t.current_row + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return a formatted string representation of the table.
|
--- Return a formatted string representation of the table.
|
||||||
|
|||||||
Reference in New Issue
Block a user