FunctionContext Class

From DiceRoller Documentation

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.