Difference between revisions of "Dice/MacroContext/Param"

From DiceRoller Documentation
(Created page with "{{APIdoc|MacroContext.Param Property}} Gets the parameter passed to the macro. {{ns}} == Syntax == <syntaxhighlight lang="C#"> public string Param { get; private set; } </sy...")
 
 
Line 12: Line 12:
 
Type: System.String
 
Type: System.String
  
The parameter passed to the macro. The callback is responsible for parsing this into something useful and acting accordingly.
+
The parameter passed to the macro. If not using the recommended method of separating arguments with colons, the callback is responsible for parsing this into something useful and acting accordingly.
  
 
== Remarks ==
 
== Remarks ==
 
All leading and trailing whitespace is trimmed from Param, so the macro {{c|[  a  ]}} and the macro {{c|[a]}} have equivalent Params ({{cs|"a"}}). The full string from the macro is passed into Param, no additional parsing is performed. It is up to the macro callback to parse Param into something useful.
 
All leading and trailing whitespace is trimmed from Param, so the macro {{c|[  a  ]}} and the macro {{c|[a]}} have equivalent Params ({{cs|"a"}}). The full string from the macro is passed into Param, no additional parsing is performed. It is up to the macro callback to parse Param into something useful.
  
A recommended method is to separate macro arguments via the colon character, for example {{c|[a:b:c]}} would execute a macro named "a" with "b" and "c" as the two arguments passed into it. However, you are free to use whatever method you wish.
+
A recommended method is to separate macro arguments via the colon character, for example {{c|[a:b:c]}} would execute a macro named "a" with "b" and "c" as the two arguments passed into it. If you use this method, these are pre-parsed for you and available in the [[../Name|Name]] and [[../Arguments|Arguments]] properties (so you do not need to use Param at all in that case).

Latest revision as of 23:18, 14 August 2017

Gets the parameter passed to the macro.

  • Namespace: Dice
  • Assembly: DiceRoller (in DiceRoller.dll)

Syntax

public string Param { get; private set; }

Property Value

Type: System.String

The parameter passed to the macro. If not using the recommended method of separating arguments with colons, the callback is responsible for parsing this into something useful and acting accordingly.

Remarks

All leading and trailing whitespace is trimmed from Param, so the macro [ a ] and the macro [a] have equivalent Params ("a"). The full string from the macro is passed into Param, no additional parsing is performed. It is up to the macro callback to parse Param into something useful.

A recommended method is to separate macro arguments via the colon character, for example [a:b:c] would execute a macro named "a" with "b" and "c" as the two arguments passed into it. If you use this method, these are pre-parsed for you and available in the Name and Arguments properties (so you do not need to use Param at all in that case).