1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-22 07:29:01 +00:00

Lua 5.2 upgrade [1] for NSE.

[1] http://seclists.org/nmap-dev/2012/q2/34
This commit is contained in:
batrick
2012-05-27 08:53:32 +00:00
parent a839e69449
commit 000f6dc4d9
553 changed files with 13477 additions and 8870 deletions

View File

@@ -23,24 +23,27 @@
-- Modified 02/27/2010 - v0.4 Added unicode handling (written by David Fifield). Renamed toJson
-- and fromJson intogenerate() and parse(), implemented more proper numeric parsing and added some more error checking.
module("json", package.seeall)
require("bit")
require("nsedebug")
local bit = require "bit"
local nmap = require "nmap"
local stdnse = require "stdnse"
local string = require "string"
local table = require "table"
_ENV = stdnse.module("json", stdnse.seeall)
--Some local shortcuts
local function dbg(str,...)
stdnse.print_debug("Json:"..str, unpack(arg))
stdnse.print_debug("Json:"..str, table.unpack(arg))
end
local function d4(str,...)
if nmap.debugging() > 3 then dbg(str,unpack(arg)) end
if nmap.debugging() > 3 then dbg(str,table.unpack(arg)) end
end
local function d3(str,...)
if nmap.debugging() > 2 then dbg(str,unpack(arg)) end
if nmap.debugging() > 2 then dbg(str,table.unpack(arg)) end
end
--local dbg =stdnse.print_debug
local function dbg_err(str,...)
stdnse.print_debug("json-ERR:"..str, unpack(arg))
stdnse.print_debug("json-ERR:"..str, table.unpack(arg))
end
-- Javascript null representation, see explanation above
@@ -535,3 +538,5 @@ function test()
end
end
end
return _ENV;