How to check if strProp is null? (Solved)
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
-
- Kobold
- Posts: 24
- Joined: Wed Oct 06, 2010 10:35 am
How to check if strProp is null? (Solved)
I want to check if a key exists in a strProp and if it does not, create it (with setStrProp), but if it does exist, just get its value (getStrProp). So how do I test this?
Last edited by LarryHunsaker on Thu Apr 24, 2014 4:22 pm, edited 1 time in total.
Re: How to check if strProp is empty (null)?
You can use Wiki: getStrProp(). You can set a value for default when the key isn't found. For example:
Would return -1 because there is no "c" key.
Code: Select all
[getStrProp("a=1;b=2","c",-1)]
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
-
- Kobold
- Posts: 24
- Joined: Wed Oct 06, 2010 10:35 am
Re: How to check if strProp is empty (null)?
Perfect, thanks. Too bad that is not in the Wiki, seems a simple enough addition.
Re: How to check if strProp is empty (null)?
It describes it in the wiki under parameters, default.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
-
- Kobold
- Posts: 24
- Joined: Wed Oct 06, 2010 10:35 am
Re: How to check if strProp is empty (null)?
I guess I did not realize that is what it meant, I was thinking it was talking about the key not being in the campaign property list but just added later to the token. Perhaps if it said, result returned when key does not exist, rather then key is not found.