getLibPropertyNames: Difference between revisions
m (Conversion script moved page GetLibPropertyNames to getLibPropertyNames: Converting page titles to lowercase) |
m (Text replacement - "source>" to "syntaxhighlight>") |
||
Line 12: | Line 12: | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
getLibPropertyNames() | getLibPropertyNames() | ||
</ | </syntaxhighlight> | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
getLibPropertyNames(delim) | getLibPropertyNames(delim) | ||
</ | </syntaxhighlight> | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
getLibPropertyNames(id, delim) | getLibPropertyNames(id, delim) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|delim|The delimiter used to separate the values in the [[String List]], defaults to {{code|","}}. Returns a [[JSON Array]] if set to {{code|"json"}}. }} | {{param|delim|The delimiter used to separate the values in the [[String List]], defaults to {{code|","}}. Returns a [[JSON Array]] if set to {{code|"json"}}. }} | ||
Line 27: | Line 27: | ||
[h: names = getLibPropertyNames()] | [h: names = getLibPropertyNames()] | ||
[foreach(name, names, "<br>"): name] | [foreach(name, names, "<br>"): name] | ||
</ | </syntaxhighlight> | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[h: names = getLibPropertyNames("Lib:some_lib_token")] | [h: names = getLibPropertyNames("Lib:some_lib_token")] | ||
[foreach(name, names, "<br>"): name] | [foreach(name, names, "<br>"): name] | ||
</ | </syntaxhighlight> | ||
|changes= | |changes= |
Revision as of 17:10, 14 March 2023
getLibPropertyNames() Function
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 to macros. getLibPropertyNames 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().
Usage
<source lang="mtmacro" line> getLibPropertyNames() </syntaxhighlight> <source lang="mtmacro" line> getLibPropertyNames(delim) </syntaxhighlight> <source lang="mtmacro" line> getLibPropertyNames(id, delim) </syntaxhighlight> Parameters
delim
- The delimiter used to separate the values in the String List, defaults to","
. Returns a JSON Array if set to"json"
.id
- The tokenid
of the token which has its property names returned, defaults to the Current Token. This parameter may be*
orthis
to indicate the current Lib token that this macro is executing on.Note: This parameter can only be used in a Trusted Macro.
Example
[h: names = getLibPropertyNames()]
[foreach(name, names, "
"): name]
</syntaxhighlight>
<source lang="mtmacro" line>
[h: names = getLibPropertyNames("Lib:some_lib_token")]
[foreach(name, names, "
"): name]