< Dice | MacroRegistry
Difference between revisions of "Dice/MacroRegistry/RegisterMacro"
From DiceRoller Documentation
(Created page with "{{APIdoc|MacroRegistry.RegisterMacro Method (String, MacroCallback)}} Registers the specified callback to the given name. {{ns}} == Syntax == <syntaxhighlight lang="C#"> pub...") |
(No difference)
|
Latest revision as of 19:21, 15 September 2017
Registers the specified callback to the given name.
- Namespace: Dice
- Assembly: DiceRoller (in DiceRoller.dll)
Syntax
public void RegisterMacro(
string name,
MacroCallback callback
)
Parameters
- name
- Type: System.String
- Macro name to register. Macro names are case-insensitive.
- callback
- Type: Dice.MacroCallback
- The method to be called whenever the macro is called in a dice expression.
Exceptions
| Exception | Condition |
|---|---|
| ArgumentNullException | name is null.
|
| ArgumentException | name is the empty string. |
| InvalidOperationException | A macro with the same name has already been registered. |
Remarks
This registers a new macro with the given name.
There can only be one callback associated with any given macro name. It is an error to re-register a macro, but a macro can be removed and then registered again.