I think that the ability to check whether a json object is empty via simply comparing string value "{}" has been broken in the most recent version of maptool. I used to use it extensively before b91, but now it always causes an error. I'm thinking that the parser is taking the empty json as a literal empty json rather than allowing it to be considered a string.
Anyone else can confirm?
UPDATE: I also get an error if I check to see if a json object == 0. Apparently the IF statement does not like to compare json objects to any other variable type.
if(Value == "{}") Broken? (solved)
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
if(Value == "{}") Broken? (solved)
Last edited by Tanthos on Sat Feb 21, 2015 8:51 pm, edited 1 time in total.
Re: if(Value == "{}") Broken?
I don't think you can compare a json to a json that way. It may have worked before as a string comparison, but "{}" isn't really a string, but a json object. I recommend just using json.isEmpty(Value) instead because it works for strings and jsons. You can also use Wiki: json.equals().
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: if(Value == "{}") Broken?
That (OP) broke on me in earlier versions as well so I always work with the Json functions as am suggested
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS