getPropertyNames: Difference between revisions
No edit summary |
No edit summary |
||
Line 22: | Line 22: | ||
[foreach(name, names, "<br>"): name] | [foreach(name, names, "<br>"): name] | ||
</source> | </source> | ||
===Notes=== | |||
When token properties are created during campaign, they are persistent in the MapTool campaign, regardless of whether they are editable in the Edit Token window. In other words, even though a property is removed from the campaign properties, it remains available in the MapTool code. ''getPropertyNames()'' will return ''all'' token properties that exist or have ever existed in the particular campaign, even if users cannot directly edit those properties (''i.e.'', they do not appear in the token's properties when you double click on a token). To get only properties that are currently visible and editable, use [[Macros:Functions:getAllPropertyNames|getAllPropertyNames()]]. |
Revision as of 16:17, 6 January 2009
Function getPropertyNames
Returns a list containing the names of the names of the properties on the Current Token. The type of the value returned depends on the delimiter parameter.
- If the delimiter is not specified then a string list is returned with the default value of ',' is used.
- If the delimiter "json" then a json array is returned. (as of MapTool 1.3b49)
- Otherwise a string list is returned with the delimiter passed in.
[h: names = getPropertyNames()]
[h: names = getPropertyNames(delim)]
delim is the delimiter used to separate the values in the string list which defaults to ',' if not specified.
Examples
To display the names of all of the properties on the current token use.
[h: names = getPropertyNames()]
[foreach(name, names, "<br>"): name]
Notes
When token properties are created during campaign, they are persistent in the MapTool campaign, regardless of whether they are editable in the Edit Token window. In other words, even though a property is removed from the campaign properties, it remains available in the MapTool code. getPropertyNames() will return all token properties that exist or have ever existed in the particular campaign, even if users cannot directly edit those properties (i.e., they do not appear in the token's properties when you double click on a token). To get only properties that are currently visible and editable, use getAllPropertyNames().