I have a problem with handling/reading unexisting JSON object key(s).
Godot script to get the emotion:
var emotion = character["emotion"]
My problem is, some character have this:
It has no emotion, just a name. Obviously, I can't get the emotion from that. But my game crash and outputs this:
"Invalid get index 'emotion' (on base: 'Dictionary').".
I would like to try and catch the error and just ignore it.
Or atleast do this:
if(character["emotion"] == null):
var emotion = null #or "noEmotion"
print('character["emotion"] is empty!')
How can I do this? I've found out that Godot Script doesn't support try catch?