Difference between revisions of "Dice/FunctionContext/FunctionContext"

From DiceRoller Documentation
(Created page with "{{APIdoc|FunctionContext Constructor (FunctionScope, String, IReadOnlyList<DiceAST>)}} Constructs a new instance of FunctionContext. {{ns}} == Syntax == <syntaxhighlight lan...")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{APIdoc|FunctionContext Constructor (FunctionScope, String, IReadOnlyList<DiceAST>)}}
+
{{APIdoc|FunctionContext Constructor (FunctionScope, String, IReadOnlyList<DiceAST>, RollData)}}
 
Constructs a new instance of FunctionContext.
 
Constructs a new instance of FunctionContext.
  
Line 9: Line 9:
 
     FunctionScope scope,
 
     FunctionScope scope,
 
     string name,
 
     string name,
     IReadOnlyList<DiceAST> arguments
+
     IReadOnlyList<DiceAST> arguments,
 +
    RollData data
 
)
 
)
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 26: Line 27:
 
: The list of arguments that were passed to the function, may be an empty list.
 
: The list of arguments that were passed to the function, may be an empty list.
  
== Exceptions ==
+
; ''data''
{| class="wikitable"
+
: Type: {{l|Dice.RollData}}
! Exception !! Condition
+
: Data for the dice roll.
|-
 
| ArgumentNullException
 
| ''name'' is {{cs|null}}
 
 
 
-or-
 
 
 
''arguments'' is {{cs|null}}.
 
|-
 
| ArgumentException || ''arguments'' contains {{cs|null}} values in the list.
 
|}
 
  
 
== Remarks ==
 
== Remarks ==
Value is initialized to Decimal.MinValue and ValueType is initialized to ResultType.Total. The function's callback '''must''' modify Value to some other value, and may modify Values and ValueType if the defaults are insufficient. See [[Dice/AST/FunctionNode/CallFunction|FunctionNode.CallFunction]] for more details on how Values and ValueType interacts if they are left at their defaults.
+
[[../Value|Value]] is initialized to Decimal.MinValue, [[../Values|Values]] is initialized to {{cs|null}}, and [[../ValueType|ValueType]] is initialized to ResultType.Total. The function's callback '''must''' modify Value to some other value, and may modify Values and ValueType if the defaults are insufficient. See the documentation for Values and ValueType for more details on how they interact if they are left at their defaults.

Latest revision as of 23:11, 14 August 2017

Constructs a new instance of FunctionContext.

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

Syntax

internal FunctionContext(
    FunctionScope scope,
    string name,
    IReadOnlyList<DiceAST> arguments,
    RollData data
)

Parameters

scope
Type: Dice.FunctionScope
Scope that the function was called in.
name
Type: System.String
Name of the function that was called, cased according to how it was registered.
arguments
Type: System.Collections.Generic.IReadOnlyList<Dice.AST.DiceAST>
The list of arguments that were passed to the function, may be an empty list.
data
Type: Dice.RollData
Data for the dice roll.

Remarks

Value is initialized to Decimal.MinValue, Values is initialized to null, and ValueType is initialized to ResultType.Total. The function's callback must modify Value to some other value, and may modify Values and ValueType if the defaults are insufficient. See the documentation for Values and ValueType for more details on how they interact if they are left at their defaults.