mirror of
https://github.com/nmap/nmap.git
synced 2025-12-17 05:09:00 +00:00
Changed JSON null-check to the json.NULL constant per David's recommendation.
This commit is contained in:
@@ -41,9 +41,7 @@ local geoplugin = function(ip)
|
|||||||
|
|
||||||
local output = {}
|
local output = {}
|
||||||
table.insert(output, "coordinates (lat,lon): "..loc.geoplugin_latitude..","..loc.geoplugin_longitude)
|
table.insert(output, "coordinates (lat,lon): "..loc.geoplugin_latitude..","..loc.geoplugin_longitude)
|
||||||
-- The JSON response for regionName contains a null sometimes which is represented
|
local regionName = (loc.geoplugin_regionName == json.NULL) and "Unknown" or loc.geoplugin_regionName
|
||||||
-- as a table by the library.
|
|
||||||
local regionName = ("table" == type(loc.geoplugin_regionName)) and "Unknown" or loc.geoplugin_regionName
|
|
||||||
table.insert(output,"state: ".. regionName ..", ".. loc.geoplugin_countryName)
|
table.insert(output,"state: ".. regionName ..", ".. loc.geoplugin_countryName)
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|||||||
Reference in New Issue
Block a user