mirror of
https://github.com/nmap/nmap.git
synced 2025-12-15 12:19:02 +00:00
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
36 KiB
36 KiB