Nmap Development mailing list archives
Re: [NSE patch] addrow() function for tab.lua
From: Sven Klemm <sven () c3d2 de>
Date: Sat, 30 Aug 2008 18:43:40 +0200
Sven Klemm wrote:
Sven Klemm wrote: | I've attached a patch that adds an addrow() function to tab.lua, | which can be used to add a complete row to a table instead of calling | add for each column. With the addrow() function you can write ~ tab.addrow( t, 'col1', 'col2', 'col3', 'col4' ) instead of writing ~ tab.add( t, 1, 'col1') ~ tab.add( t, 2, 'col2') ~ tab.add( t, 3, 'col3') ~ tab.add( t, 4, 'col4') ~ tab.nextrow( t ) which is nice if you want to add a complete row at once.
I've updated the patch to apply cleanly to nmap HEAD. Cheers, Sven
Index: nselib/tab.lua
===================================================================
--- nselib/tab.lua (revision 9859)
+++ nselib/tab.lua (working copy)
@@ -41,6 +41,16 @@
return true
end
+--- 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().
+function addrow(t,...)
+ for i=1, arg['n'] do
+ add( t, i, tostring(arg[i]) )
+ end
+ nextrow( t )
+end
+
--- 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.
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- [NSE patch] addrow() function for tab.lua Sven Klemm (Aug 20)
- Re: [NSE patch] addrow() function for tab.lua Sven Klemm (Aug 29)
- Re: [NSE patch] addrow() function for tab.lua Sven Klemm (Aug 30)
- Re: [NSE patch] addrow() function for tab.lua Fyodor (Aug 30)
- Re: [NSE patch] addrow() function for tab.lua Sven Klemm (Aug 30)
- Re: [NSE patch] addrow() function for tab.lua Sven Klemm (Aug 29)
