mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 14:49: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:
parent
1ee0fae3d1
commit
974d6061b3
1 changed files with 7 additions and 7 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue