< Dice‎ | AST‎ | DiceAST

Difference between revisions of "Dice/AST/DiceAST/ToString"

From DiceRoller Documentation
(Created page with "{{APIdoc|DiceAST.ToString Method ()}} Retrieves a normalized representation of the dice expression. {{ns}} == Syntax == <syntaxhighlight lang="C#"> public abstract override...")
 
 
Line 15: Line 15:
  
 
== Remarks ==
 
== Remarks ==
The normalized representation of the expression represents all extras in their function form, and re-orders functions so that they go left-to-right in the order of their FunctionTiming. Casing is additionally normalized to the function casing used when registering the function.
+
The normalized representation of the expression represents all extras in their function form, and re-orders functions so that they go left-to-right in the order of their FunctionTiming. Casing is additionally normalized to the function casing used when registering the function. If there are nested rolls, these are fully evaluated and their results placed into the appropriate spot.
  
 
For example, if {{c|a()}} was registered as a roll function with FunctionTiming.First and {{c|b()}} and {{c|c()}} were both registered with FunctionTiming.Last, the dice expression {{c|1d20rr<2rr>19.c().a().b()}} would have the following string value: {{c|1d20.a().reroll(<2, >19).c().b()}}.
 
For example, if {{c|a()}} was registered as a roll function with FunctionTiming.First and {{c|b()}} and {{c|c()}} were both registered with FunctionTiming.Last, the dice expression {{c|1d20rr<2rr>19.c().a().b()}} would have the following string value: {{c|1d20.a().reroll(<2, >19).c().b()}}.

Latest revision as of 05:04, 23 December 2018

Retrieves a normalized representation of the dice expression.

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

Syntax

public abstract override string ToString()

Return Value

Type: System.String

Normalized representation of the dice expression. This may differ from the exact string that was typed in by the user.

Remarks

The normalized representation of the expression represents all extras in their function form, and re-orders functions so that they go left-to-right in the order of their FunctionTiming. Casing is additionally normalized to the function casing used when registering the function. If there are nested rolls, these are fully evaluated and their results placed into the appropriate spot.

For example, if a() was registered as a roll function with FunctionTiming.First and b() and c() were both registered with FunctionTiming.Last, the dice expression 1d20rr<2rr>19.c().a().b() would have the following string value: 1d20.a().reroll(<2, >19).c().b().