Nmap Development mailing list archives

[NSE patch] addrow() function for tab.lua


From: Sven Klemm <sven () c3d2 de>
Date: Wed, 20 Aug 2008 11:25:29 +0200

Hi,

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.

Cheers,
Sven

--
Sven Klemm
http://cthulhu.c3d2.de/~sven/

Index: nselib/tab.lua
===================================================================
--- nselib/tab.lua      (revision 9631)
+++ nselib/tab.lua      (revision 9632)
@@ -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: