18.09.2020, 08:06
When decoding a json string you can get different errors.
Is this code the best way to handle errors? or is there a more generic way to do this?
Is this code the best way to handle errors? or is there a more generic way to do this?
Code:
if states and states ~= '' then
local success, res = pcall(json.decode, states)
if success then
states = res
end
end