CC: Tweaked

CC: Tweaked

42M Downloads

Bug in textutils.unserialiseJSON()

JakobDev opened this issue ยท 1 comments

commented

While writing a new package manager for CC (not for a PR) that used json files, I discoverd a bug. This JSOn file does not work with textutils.unserialiseJSON(). Example code to reproduce:

local h = http.get("https://gitlab.com/JakobDev/Computercraft/-/raw/master/ccptrepo.json")
local sText = h.readAll()
h.close()
local tContent, sError = textutils.unserialiseJSON(sText)
if not tContent the: Unexn
    print(sError)
end

Throws the following error:
Malformed JSON at position 3: Unexpected " ", expected object key

commented

https://github.com/SquidDev-CC/CC-Tweaked/blob/50473afea88421871ab0a7f8b08ecbe710fc1345/src/main/resources/data/computercraft/lua/rom/apis/textutils.lua#L435

For some silly reason we've got vertical tab here (\v) instead of horizontal (\t). I evidently wasn't thinking.