Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

ProtoFlux:TryNumberToEnum

See Enums for a more in depth explaination on what Enums are. This node can be useful for turning numbers back into Enums, in cases like reading Cloud Variables that can't store Enums normally.
TryNumberToEnum
Value
*
FailValue
OnlyDefined
Enums

The TryNumberToEnum node takes in a value and a fail enum value, then returns the enum value after attempting to get the enum, or failing that, returns the fail enum value. Similar to NumberToEnum but without the FailValue field.

This node has the following variants, with their respective outputs:

Variant Node Type Output
Try Number To Enum (Byte) ByteToEnum provided Byte as any chosen (Enum)
Try Number To Enum (Int) IntToEnum provided Int as any chosen (Enum)
Try Number To Enum (Long) LongToEnum provided Long as any chosen (Enum)
Try Number To Enum (Sbyte) SbyteToEnum provided Sbyte as any chosen (Enum)
Try Number To Enum (Short) ShortToEnum provided Short as any chosen (Enum)
Try Number To Enum (Uint) UintToEnum provided Uint as any chosen (Enum)
Try Number To Enum (Ulong) UlongToEnum provided Ulong as any chosen (Enum)
Try Number To Enum (Ushort) UshortToEnum provided Ushort as any chosen (Enum)

Inputs

Value (Variant)

The whole number to convert to a Enum of the type chosen for * (Enum Generic).

FailValue (Enum Generic)

The enum to use if the inputted value is not valid.

OnlyDefined (Bool)

Use only a defined enum value when possible.

Outputs

* (Enum Generic)

The Enum with the chosen enum type that has a number matching Value (Variant) according to Enums Page. If that failed, use the fail enum value instead.