From f14a179b449fea0486ac65769be86473876dc74b Mon Sep 17 00:00:00 2001 From: ron Date: Sat, 20 Nov 2010 16:18:18 +0000 Subject: [PATCH] Fixed a bug in stdnse.format_output() where the 'name' attribute of the top-most table wouldn't display --- nselib/stdnse.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/nselib/stdnse.lua b/nselib/stdnse.lua index 8d32d965e..796dcef52 100644 --- a/nselib/stdnse.lua +++ b/nselib/stdnse.lua @@ -460,18 +460,18 @@ local function format_output_sub(status, data, indent) -- Make sure we have an indent value indent = indent or {} + if(data['name']) then + if(data['warning'] and nmap.debugging() > 0) then + output = output .. format("%s%s%s (WARNING: %s)\n", format_get_indent(indent), prefix, data['name'], data['warning']) + else + output = output .. format("%s%s%s\n", format_get_indent(indent), prefix, data['name']) + end + elseif(data['warning'] and nmap.debugging() > 0) then + output = output .. format("%s%s(WARNING: %s)\n", format_get_indent(indent), prefix, data['warning']) + end + for i, value in ipairs(data) do if(type(value) == 'table') then - if(value['name']) then - if(value['warning'] and nmap.debugging() > 0) then - output = output .. format("%s %s%s (WARNING: %s)\n", format_get_indent(indent), prefix, value['name'], value['warning']) - else - output = output .. format("%s %s%s\n", format_get_indent(indent), prefix, value['name']) - end - elseif(value['warning'] and nmap.debugging() > 0) then - output = output .. format("%s %s(WARNING: %s)\n", format_get_indent(indent), prefix, value['warning']) - end - -- Do a shallow copy of indent local new_indent = {} for _, v in ipairs(indent) do