getTableNames: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page GetTableNames to getTableNames: Converting page titles to lowercase)
m (Text replacement - "source>" to "syntaxhighlight>")
Line 8: Line 8:
getTableNames()
getTableNames()
getTableNames(delim)
getTableNames(delim)
</source>
</syntaxhighlight>


If {{code|delim}} is specified then it is used to separate the values in the list; if it is not specified then it defaults to "{{code|,}}".  When {{code|delim}} is the string "{{code|json}}" the return value will be in the form of a [[JSON Array]].
If {{code|delim}} is specified then it is used to separate the values in the list; if it is not specified then it defaults to "{{code|,}}".  When {{code|delim}} is the string "{{code|json}}" the return value will be in the form of a [[JSON Array]].
Line 16: Line 16:
[r:getTableNames("<br>")]
[r:getTableNames("<br>")]
[r:getTableNames("json")]
[r:getTableNames("json")]
</source>
</syntaxhighlight>
|also=
|also=
[[Table|Table]], [[table (function)|table()]]
[[Table|Table]], [[table (function)|table()]]
}}
}}
[[Category:Table Function]]
[[Category:Table Function]]

Revision as of 19:09, 14 March 2023

getTableNames() Function

Introduced in version 1.4.0.1
Returns a list containing the names of the tables in the campaign. The type of the value returned depends on the delimiter parameter. The function can be used by players or from a non-trusted macro, but it will only return player-visible tables. When used by a GM or a trusted macro it returns all tables.

Usage

<source lang="mtmacro" line> getTableNames() getTableNames(delim) </syntaxhighlight>

If delim is specified then it is used to separate the values in the list; if it is not specified then it defaults to ",". When delim is the string "json" the return value will be in the form of a JSON Array.

Examples

<source lang="mtmacro" line>

[r:getTableNames()] [r:getTableNames("
")] [r:getTableNames("json")]

</syntaxhighlight>

See Also