formatStrProp

From RPTools Wiki
Revision as of 18:38, 21 January 2009 by Lindharin (talk | contribs) (New page: ==Function formatStrProp== Returns a custom-formatted version of the property string. ===Usage=== <source lang="mtmacro" line> [h: formatStrProp(props, listFormat, entryFormat, separator)...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function formatStrProp

Returns a custom-formatted version of the property string.

Usage

[h: formatStrProp(props, listFormat, entryFormat, separator) ]
  • listFormat is a string that is emitted once. It should contain the text "%list", which is replaced with the formatted items.
  • entryFormat is emitted once per item. Any instances of "%key" and "%value" in the string are replaced with the key or value for that setting.
  • separator is emitted in between the formatted items.

Examples

[h: props = "Strength=14 ; Constitution=8 ; Dexterity=13 ; Intelligence=4 ; Wisdom=18 ; Charisma=9"]
[formatStrProp(props, "<table border=1>%list</table>", "<tr> <td><b>%key</b></td> <td>%value</td> </tr>", "")]

(prints settings in a formatted table):