varsFromStrProp: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function varsFromStrProp== Creates variables from a Macros:string property list with the values assigned to variables with the names of the keys in the [[Macros:string property lis...)
 
No edit summary
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==Function varsFromStrProp==
{{stub|Documentation on how the decor(suffixed/unsuffixed) parameter works.}}
 
{{MacroFunction
|name=varsFromStrProp
|version=1.3b42
|description=
Creates variables from a [[Macros:string property list|string property list]] with the values assigned to variables with the names of the keys in the [[Macros:string property list|string property list]]. The function returns the number of variables that were created.
Creates variables from a [[Macros:string property list|string property list]] with the values assigned to variables with the names of the keys in the [[Macros:string property list|string property list]]. The function returns the number of variables that were created.


===Usage===
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro">
[h: num = varsFromStrProp(props)]
varsFromStrProp(props)
</source>
varsFromStrProp(props, decor)
</syntaxhighlight>
'''Parameters'''
{{param|props|A string property list.}}
{{param|decor|Either SUFFIXED, which appends an underscore to the variable name, or UNSUFFIXED (default) which leaves the name as is.}}


|examples=
<syntaxhighlight lang="mtmacro" line>
[h: varsFromStrProp("a=blah; b=doh; c=meh")]
[r: a] [r: b] [r: c]
</syntaxhighlight>
'''Returns'''
<syntaxhighlight lang="mtmacro">
blah doh meh
</syntaxhighlight>
|also=
{{func|strPropFromVars}}
|changes=
{{change|1.3b49|Added {{code|suffixed}} or {{code|unsuffixed}} parameter option.}}


===Examples===
}}
<source lang="mtmacro" line>
[[Category:String Property List Function]]
    [h: varsFromStrProp("a=blah; b=doh; c=meh")][r: a] [r: b] [r: c]
</source>
Returns
    blah do meh

Latest revision as of 17:00, 13 March 2023

 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
 This article needs: Documentation on how the decor(suffixed/unsuffixed) parameter works.

varsFromStrProp() Function

Introduced in version 1.3b42
Creates variables from a string property list with the values assigned to variables with the names of the keys in the string property list. The function returns the number of variables that were created.

Usage

varsFromStrProp(props)
varsFromStrProp(props, decor)

Parameters

  • props - A string property list.
  • decor - Either SUFFIXED, which appends an underscore to the variable name, or UNSUFFIXED (default) which leaves the name as is.

Examples

[h: varsFromStrProp("a=blah; b=doh; c=meh")]
[r: a] [r: b] [r: c]

Returns

blah doh meh

See Also

Version Changes

  • 1.3b49 - Added suffixed or unsuffixed parameter option.