1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-01 02:59:01 +00:00
Files
nmap/nselib
dmiller 930bc91359 Modify stdnse.output_table to handle empty values better
Two changes here, both minor. First, explicitly assigning a new key to
nil does not add the key to the ordered set of keys. This better
emulates the behavior of regular tables.

> o = stdnse.output_table()
> o["test"] = nil

This previously resulted in output like this:

|_ test: nil

Now it simply omits the "test:" key.

Second, I needed a way to tell whether an output table was empty or not.
Since Lua's next() function doesn't call the __pairs metamethod, it was
always returning nil. Instead, I used the __call metamethod, since it
had the least preexisting semantic meaning:

> o = stdnse.output_table()
> =o()
false
> o["test"] = 1
> =o()
true
2013-05-06 18:39:54 +00:00
..
2012-05-27 08:53:32 +00:00
2012-06-09 18:44:46 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-12-16 16:51:47 +00:00
2012-10-07 12:54:31 +00:00
2012-05-27 08:53:32 +00:00
2012-10-06 21:19:22 +00:00
2012-05-27 08:53:32 +00:00
2012-07-29 09:26:23 +00:00
2012-05-27 08:53:32 +00:00
2012-06-09 18:44:46 +00:00
2012-05-27 08:53:32 +00:00
2012-10-25 20:05:15 +00:00
2012-05-27 08:53:32 +00:00
2012-08-17 05:37:59 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-12-02 16:15:59 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-11-16 02:15:00 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-08-31 15:22:29 +00:00
2012-05-27 08:53:32 +00:00
2012-09-02 22:45:16 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-10-06 19:38:15 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-11-16 02:24:02 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-11-16 02:25:08 +00:00
2012-05-28 18:04:28 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-10-07 08:54:34 +00:00
2012-10-07 12:39:21 +00:00
2012-05-27 08:53:32 +00:00
2012-05-29 20:11:39 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-10-10 22:19:49 +00:00
2012-07-10 21:18:23 +00:00
2013-02-24 04:55:40 +00:00
2012-10-14 19:15:39 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00