< Dice | FunctionRegistry
FunctionRegistry.RegisterFunction Method (String, FunctionCallback)
From DiceRoller Documentation
Registers the specified global callback to the given name.
- Namespace: Dice
- Assembly: DiceRoller (in DiceRoller.dll)
Syntax
public void RegisterFunction(
string name,
FunctionCallback callback
)
Parameters
- name
- Type: System.String
- Function name to register. Function names are case-insensitive.
- callback
- Type: Dice.FunctionCallback
- The method to be called whenever the function is called in a dice expression.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | name is null .
|
ArgumentException | name is the empty string. |
InvalidOperationException | A global function with the same name has already been registered. |
Remarks
This registers a new global function with the given name (FunctionScope.Global).
There can only be one callback associated with any given function name and scope. It is an error to re-register a function, but a function can be removed and then registered again.