Skip to content

Commit

Permalink
merge in loadstring hack for json
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Oct 26, 2023
2 parents 1ade5af + 90224b7 commit ca610e6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Configuration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
3 changes: 3 additions & 0 deletions src/chkJson
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
9 changes: 9 additions & 0 deletions src/spider.in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ require("modfuncs")
require("cmdfuncs")
require("deepcopy")
require("parseVersion")
require("declare")
MainControl = require("MainControl")
Cache = require("Cache")
MRC = require("MRC")
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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))
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit ca610e6

Please sign in to comment.