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...")
 
 
(3 intermediate revisions by the same user not shown)
Line 18: Line 18:
 
! Name !! Description
 
! Name !! Description
 
|-
 
|-
| {{internal}} {{method}} || [[/FunctionContext|FunctionContext(FunctionScope, String, IReadOnlyList<DiceAST>)]] || Constructs a new instance of FunctionContext.
+
| {{internal}} {{method}} || [[/FunctionContext|FunctionContext(FunctionScope, String, IReadOnlyList<DiceAST>, RollData)]] || Constructs a new instance of FunctionContext.
 
|}
 
|}
  
Line 27: Line 27:
 
|-
 
|-
 
| {{public}} {{property}} || [[/Arguments|Arguments]] || Gets the arguments to the function call.
 
| {{public}} {{property}} || [[/Arguments|Arguments]] || Gets the arguments to the function call.
 +
|-
 +
| {{public}} {{property}} || [[/Data|Data]] || Gets the RollData attached to this function execution.
 
|-
 
|-
 
| {{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.

Latest revision as of 23:11, 14 August 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>, RollData) Constructs a new instance of FunctionContext.

Properties

Name Description
Arguments Gets the arguments to the function call.
Data Gets the RollData attached to this function execution.
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.