From 165b58f3d39f06e0c0e20dfa92824151936c4ad5 Mon Sep 17 00:00:00 2001 From: batrick Date: Fri, 16 Dec 2011 21:01:09 +0000 Subject: [PATCH] minor improvements --- nse_main.lua | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/nse_main.lua b/nse_main.lua index 1c19f9488..8b8a0e19a 100644 --- a/nse_main.lua +++ b/nse_main.lua @@ -414,13 +414,11 @@ do local short_basename = match(filename, "([^/\\]+)%.nse$") or match(filename, "([^/\\]+)%.[^.]*$") or filename; - if debugging() > 1 then - print_debug(2, "Script %s was selected by %s%s.", - basename, - script_params.selection and - script_params.selection or "(unknown)", - script_params.forced and " and forced to run" or ""); - end + print_debug(2, "Script %s was selected by %s%s.", + basename, + script_params.selection and + script_params.selection or "(unknown)", + script_params.forced and " and forced to run" or ""); local file_closure = assert(loadfile(filename)); -- Give the closure its own environment, with global access local env = { @@ -538,11 +536,12 @@ local function get_chosen_scripts (rules) -- Boolean: True if it's forced otherwise false. -- String: The new cleaned string. local function is_forced_set (str) - local substr, count = gsub(str, "^%+", ""); - if count > 0 then - return true, substr; + local specification = match(str, "^%+(.*)$"); + if specification then + return true, specification; + else + return false, str; end - return false, str; end -- Globalize all names in str that are not protected_lua_tokens