diff --git a/src/Configuration.lua b/src/Configuration.lua index 01908d760..142c0d827 100644 --- a/src/Configuration.lua +++ b/src/Configuration.lua @@ -375,6 +375,9 @@ end -- @param self A Configuration object -- @return the configuration report in json as a single string. function M.report_json(self) + require("declare") + declare("loadstring") + loadstring = (_VERSION == "Lua 5.1") and loadstring or load local json = require("json") local tbl = self.tbl local configT = {} diff --git a/src/chkJson b/src/chkJson index db0b7310c..f6ef94dbf 100644 --- a/src/chkJson +++ b/src/chkJson @@ -48,6 +48,9 @@ package.cpath = LuaCommandName_dir .. "../lib/?.so;".. require("strict") require("serializeTbl") +require("declare") +declare("loadstring") +loadstring = (_VERSION == "Lua 5.1") and loadstring or load local Dbg = require("Dbg") local json = require("json") diff --git a/src/spider.in.lua b/src/spider.in.lua index 5d7c64578..2ddea3f90 100644 --- a/src/spider.in.lua +++ b/src/spider.in.lua @@ -102,6 +102,7 @@ require("modfuncs") require("cmdfuncs") require("deepcopy") require("parseVersion") +require("declare") MainControl = require("MainControl") Cache = require("Cache") MRC = require("MRC") @@ -342,6 +343,8 @@ end local function l_rptReverseMapTJson(mpathMapT, spiderT, timestampFn, dbT, providedByT) dbg.start{ "l_rptReverseMapTJson(mpathMapT, spiderT, timestampFn, dbT, providedByT)"} + declare("loadstring") + loadstring = (_VERSION == "Lua 5.1") and loadstring or load local json = require("json") local reverseMapT = l_buildReverseMapT(dbT) local libA = l_buildLibMapA(reverseMapT) @@ -354,6 +357,8 @@ end local function l_rptXALTRmapTJson(mpathMapT, spiderT, timestampFn, dbT, providedByT) dbg.start{ "l_rptXALTRmapTJson(mpathMapT, spiderT, timestampFn, dbT, providedByT)"} + declare("loadstring") + loadstring = (_VERSION == "Lua 5.1") and loadstring or load local json = require("json") local reverseMapT = l_buildReverseMapT(dbT) local libA = l_buildLibMapA(reverseMapT) @@ -366,6 +371,8 @@ end local function l_rptSoftwarePageJson(mpathMapT, spiderT, timestampFn, dbT, providedByT) dbg.start{ "l_rptSoftwarePageJson(mpathMapT, spiderT, timestampFn, dbT, providedByT)"} + declare("loadstring") + loadstring = (_VERSION == "Lua 5.1") and loadstring or load local json = require("json") local spA = softwarePage(dbT) print(json.encode(spA)) @@ -399,6 +406,8 @@ end local function l_rptDbTJson(mpathMapT, spiderT, timestampFn, dbT, providedByT) dbg.start{ "l_rptDbTJson(mpathMapT, spiderT, timestampFn, dbT, providedByT)"} + declare("loadstring") + loadstring = (_VERSION == "Lua 5.1") and loadstring or load local json = require("json") print(json.encode(dbT)) dbg.fini("l_rptDbTJson")