getDefinedFunctions: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "source>" to "syntaxhighlight>") |
m (Text replacement - "<source" to "<syntaxhighlight") |
||
Line 6: | Line 6: | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
getDefinedFunctions() | getDefinedFunctions() | ||
getDefinedFunctions(delim) | getDefinedFunctions(delim) | ||
Line 17: | Line 17: | ||
|examples= | |examples= | ||
'''For Plain Text output''': | '''For Plain Text output''': | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[r: getDefinedFunctions()] | [r: getDefinedFunctions()] | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 28: | Line 28: | ||
</pre> | </pre> | ||
'''For JSON output''': | '''For JSON output''': | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[r: getDefinedFunctions("json", 1)] | [r: getDefinedFunctions("json", 1)] | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 55: | Line 55: | ||
</pre> | </pre> | ||
'''For string list output''': | '''For string list output''': | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[r: theList = getDefinedFunctions(",")] | [r: theList = getDefinedFunctions(",")] | ||
[r, foreach(udf, theList, "<br />"): udf] | [r, foreach(udf, theList, "<br />"): udf] |
Revision as of 18:50, 14 March 2023
getDefinedFunctions() Function
• Introduced in version 1.7
Returns a list of the user defined functions that have been registered with defineFunction(). Uses the corresponding macro's tooltip, if any, as a function description.
Usage
getDefinedFunctions()
getDefinedFunctions(delim)
getDefinedFunctions(delim, showFullLocations)
Parameters
delim
- The delimiter used to separate the output. If""
is specified, the default plain text output is produced. If"json"
is specified, a JSON array is produced. Otherwise, a string list is produced separated by the given delimiter. Defaults to""
, producing plain text output. See below for examples of output format.showFullLocations
- Whether fully-qualified macro locations should be included in the output. Defaults tofalse
.
Examples
For Plain Text output:
[r: getDefinedFunctions()]
Produces:
a5e.debug - Lists all the available properties and their values. Useful for debugging. a5e.jget a5e.output a5e.rollDice - Rolls some dice.
For JSON output:
[r: getDefinedFunctions("json", 1)]
Produces:
[ { "name": "a5e.debug", "source": "debug@Lib:Addon5e", "description": "Lists all the available properties and their values. Useful for debugging." }, { "name": "a5e.jget", "source": "jget@Lib:Addon5e" }, { "name": "a5e.output", "source": "output@Lib:Addon5e" }, { "name": "a5e.rollDice", "source": "rollDice@Lib:Addon5e", "description": "Rolls some dice." } ]
For string list output:
[r: theList = getDefinedFunctions(",")]
[r, foreach(udf, theList, "<br />"): udf]
Produces:
a5e.debug,Lists all the available properties and their values. Useful for debugging.,a5e.jget,,a5e.output,,a5e.rollDice,Rolls some dice. a5e.debug Lists all the available properties and their values. Useful for debugging. a5e.jget a5e.output a5e.rollDice Rolls some dice.