Merge pull request #689 from argonui/json-decoding
Added regular JSON parser as fallback
This commit is contained in:
commit
794949fdc6
@ -116,7 +116,14 @@ end
|
||||
---@param cardData table TTS object data for the card
|
||||
function addCardToIndex(cardData)
|
||||
-- using the more efficient 'json.parse()' to speed this process up
|
||||
local cardMetadata = json.parse(cardData.GMNotes)
|
||||
local status, cardMetadata = pcall(function() json.parse(cardData.GMNotes) end)
|
||||
|
||||
-- if an error happens, fallback to the regular parser
|
||||
if status ~= true then
|
||||
cardMetadata = JSON.decode(cardData.GMNotes)
|
||||
end
|
||||
|
||||
-- if metadata was not valid JSON or empty, don't add the card
|
||||
if not cardMetadata then return end
|
||||
|
||||
-- use the ZoopGuid as fallback if no id present
|
||||
|
Loading…
x
Reference in New Issue
Block a user