- All Implemented Interfaces:
- WarpScriptStackFunction
public class SWITCH
extends NamedWarpScriptFunction
implements WarpScriptStackFunction
Implements 'Switch' like conditional
2N+2: CONDITION MACRO FOR CASE 1
2N+1: EXEC MACRO FOR CASE 1
...
4: CONDITION MACRO FOR CASE N
3: EXEC MACRO FOR CASE N
2: DEFAULT MACRO
1: Number of cases
SWITCH
Macros are popped out of the stack.
The condition macros are evaluated in order. If a condition macro returns true on the stack, the associated exec macro is evaluated.
If no condition macro returns true, the default macro is evaluated.
The boolean returned by the condition macros is consumed.
Condition macros SHOULD generally leave the stack as they found it so the next macro can be evaluated