tab NSE Library — Nmap Scripting Engine documentation (original) (raw)
Arrange output into tables.
This module provides NSE scripts with a way to output structured tables similar to what NmapOutputTable.cc
provides.
Example usage:
local t = tab.new() tab.add(t, 1, 'A1') tab.add(t, 2, 'A2') tab.nextrow(t) tab.add(t, 1, 'BBBBBBBBB1') tab.add(t, 2, 'BBB2') tab.nextrow(t) tab.addrow(t, 'C1', 'C2') tab.dump(t)
tab.add
works on the bottom-most row untiltab.nextrow
is called. Think of tab.nextrow
as typing Enter at the end of a line. tab.addrow
adds a whole row at a time and calls tab.nextrow
automatically.
Copyright © Same as Nmap--See https://nmap.org/book/man-legal.html
Source: https://svn.nmap.org/nmap/nselib/tab.lua
Functions
add (t, c, v)
Add a new string item to a table at a given column position.
addrow (t, ...)
Add a complete row to the table and move on to the next row.
dump (t)
Return a formatted string representation of the table.
new ()
Create and return a new table.
nextrow (t)
Move on to the next row in the table.
Functions
add (t, c, v)
Add a new string item to a table at a given column position.
The item will be added to the current row. If nextrow
hasn't been called yet that will be row 1.
Parameters
t
The table.
c
The column position at which to add the item.
v
The string to add.
addrow (t, ...)
Add a complete row to the table and move on to the next row.
Calls add
for each argument starting with the second argument and after that calls nextrow
.
Parameters
t
The table.
...
The elements to add to the row.
dump (t)
Return a formatted string representation of the table.
The number of spaces in a column is based on the largest element in the column with an additional two spaces for padding.
Parameters
t
The table.
new ()
Create and return a new table.
Return value:
A new table.
nextrow (t)
Move on to the next row in the table.
If this is not called then previous column values will be over-written by subsequent values.
Parameters
t
The table.