# Module `CTaskStack`

The class for the task stack

version 0.91 beta for the task stack

## Global(s)

CTaskStack() | Constructor of the class CTaskStack
taskstack | A global object of the class CTaskStack This is the default object

## Type `CTaskStack`

CTaskStack.empty() | Get if the stack is empty?
CTaskStack.getn() | Get the size of the stack.
CTaskStack.list() | list values on screen
CTaskStack.new() | It's a fabric method for objects of the class CTaskStack
CTaskStack.peek() | Let you peek on the top of the stack without removing anything.
CTaskStack.pop(num) | Pop a object from the top of the stack of
CTaskStack.push(...) | Push a object on to the stack of
CTaskStack.push_args(...) | Put the list of args to the task on top of the stack
CTaskStack.push_args_switch(args, fail_args, success_args) | Put the lists of args to the task on top of the stack This version is for the distribution of the args when you creating logical switches when you don't want to return to the original task
CTaskStack.push_switch(...) | Remove a value from the stack and than push a new value on the stack This method is for creating logical switches when you don't want to return to the original task when the new task is finished through fail or success.
CTaskStack.push_task(name, func, fail_name, fail_func, success_name, success_func) | Push a new task on the top of the stack The new task that will be pushed on the stack depends on the args
CTaskStack.run() | Run the function for the task which is on top of the stack.

## Global(s)

CTaskStack()

  Constructor of the class CTaskStack

taskstack

  A global object of the class CTaskStack This is the default object

## Type `CTaskStack`

### Field(s)

CTaskStack.empty()

  Get if the stack is empty?

  ### Return value

  #boolean: if the stack is empty or not.

CTaskStack.getn()

  Get the size of the stack.

  ### Return value

  #number: size of the stack..

CTaskStack.list()

  list values on screen

CTaskStack.new()

  It's a fabric method for objects of the class CTaskStack

  ### Return value

  #CTaskStack: new instance object of CTaskStack

CTaskStack.peek()

  Let you peek on the top of the stack without removing anything.

  ### Return value

  CTask#CTask: Return the task from the top of the stack.

CTaskStack.pop(num)

  Pop a object from the top of the stack of

  ### Parameter

  - `#number num` : optional) Number of object which should be removed from the top of the stack if nil 1

  ### Return value

  CTask#CTask: Return the task(s) from the top of the stack depend on the param num

CTaskStack.push(...)

  Push a object on to the stack of

  ### Parameter

  - `#vars ...` : A single object or a list of objects to push on the stack.

CTaskStack.push_args(...)

  Put the list of args to the task on top of the stack

  ### Parameter

  - `#vars ...` : List of args which should append on the task

CTaskStack.push_args_switch(args, fail_args, success_args)

  Put the lists of args to the task on top of the stack

  This version is for the distribution of the args when you creating logical switches when you don't want to return to the original task

  ### Parameters

  - `#table args` : List of args which should append on the task for default

  - `#table fail_args` : List of args which should append on the task for the case that the task fails.

  - `#table success_args` : List of args which should append on the task for the case that the task success.

CTaskStack.push_switch(...)

  Remove a value from the stack and than push a new value on the stack

  This method is for creating logical switches when you don't want to return to the original task when the new task is finished through fail or success.

  That the code is outsouced has only symatic reasons.

  ### Parameter

  - `CTask#CTask ...` : A single task or a list of tasks to push on the stack.

CTaskStack.push_task(name, func, fail_name, fail_func, success_name, success_func)

  Push a new task on the top of the stack The new task that will be pushed on the stack depends on the args

  ### Parameters

  - `#string name` : The name of the label for this task

  - `#function func` : The function which should be called in this task

  - `#string fail_name` : (optional) Name for the label of the task which should be called if the previous task fails.

  - `#function fail_func` : (optional)The function which should be called if the previous task fails.

  - `#string success_name` : (optional) Name for the label of the task which should be called if the previous task success.

  - `#function success_func` : (optional)The function which should be called if the previous task success.

CTaskStack.run()

  Run the function for the task which is on top of the stack.

  ### Return values

  1. #boolean: if call was success full,

  2. CTask#CONSTANCE: What happend STATEPENNDING, STATEFAILED ,STATESUCCESS, STATENIL.

  3. #vars: Unknown amount of args from the called function.

## Type `var`

Any type of var including lists

## Type `vars`

One or more incoming argument.