Difference between revisions of "Dice/FunctionContext"

From DiceRoller Documentation
(Created page with "{{APIdoc|FunctionContext Class}} Contains the context for a function call, and is passed to function callbacks. {{ns}} == Inheritance Hierarchy == System.Object :Dice.Functi...")
 
Line 30: Line 30:
 
| {{public}} {{property}} || [[/Expression|Expression]] || Gets the dice expression this function is attached to, or null if it is a global function.
 
| {{public}} {{property}} || [[/Expression|Expression]] || Gets the dice expression this function is attached to, or null if it is a global function.
 
|-
 
|-
| {{public}} {{property}} || [[/Name|Name]] || Gets the name of the function being called, converted to lowercase.
+
| {{public}} {{property}} || [[/Name|Name]] || Gets the name of the function being called, in the casing that the name was registered as.
 
|-
 
|-
 
| {{public}} {{property}} || [[/Scope|Scope]] || Gets the scope of the function being called.
 
| {{public}} {{property}} || [[/Scope|Scope]] || Gets the scope of the function being called.

Revision as of 22:12, 25 April 2017

Contains the context for a function call, and is passed to function callbacks.

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

Inheritance Hierarchy

System.Object

Dice.FunctionContext

Syntax

public class FunctionContext

Constructors

Name Description
FunctionContext(FunctionScope, String, IReadOnlyList<DiceAST>) Constructs a new instance of FunctionContext.

Properties

Name Description
Arguments Gets the arguments to the function call.
Expression Gets the dice expression this function is attached to, or null if it is a global function.
Name Gets the name of the function being called, in the casing that the name was registered as.
Scope Gets the scope of the function being called.
Value Gets or sets the result of the function call.
Values Gets or sets the underlying dice rolls for the function call that should be shown in the overall result.
ValueType Gets or sets the type of value this function returns.

Remarks

A FunctionContext is created and passed into all FunctionCallbacks. The callback must fill out Value and should also fill out Values and ValueType. Failing to fill out Value will result in an error being displayed to the user.