Module CTask

The class for the tasks

version 0.5 beta for the task class

Global(s)

CTask(name, func, fail_name, fail_func, success_name, success_func)

Constructor of the class CTask

STATE_FAILED

CONSTANCE For the case the task has failed

STATE_NIL

CONSTANCE For the case there is no task on the stack

STATE_PENNDING

CONSTANCE For the case the task should run

STATE_SUCCESS

CONSTANCE For the case the task has success

Type CTask

CTask.appendArgs(...)

Add the args to the task

CTask.appendArgsSwitch(args, fail_args, success_args)

Add the args to the task for a logical switch

CTask.getFailArgs()

Return the fails args.

CTask.getFailTask()

Return and generate the task on the fail case

CTask.getSuccessArgs()

Return the success args

CTask.getSuccessTask()

Return and generate the task on the success case

CTask.getVar(var_name)

Return a custom var for the task

CTask.hasArgsInfo()

Return if the task has args.

CTask.hasFailInfo()

Return if the task has infos about what to do in the fail case.

CTask.hasSuccessInfo()

Return if the task has infos about what to do in the success case.

CTask.run()

Run the function for this task

CTask.setVar(var_name, var)

Set a custom var for the task

CTask.update()

Update the time for the last finished run of the task

Type state

state.args

List of args with which the current state will be called.

state.fail_args

List of args with which the next state if the current fail will be called.

state.fail_func

Function which are called for the next state if the current fails.

state.fail_name

Label of the next state if the current fails.

state.last_call

The Time millisec from GetTime() when the last call was.

state.last_success

The Time millisec from GetTime() when the last successful call was.

state.state_func

Function which are called for the state

state.state_name

Label of the state

state.success_args

List of args with which the next state if the current success will be called.

state.success_func

Function which are called for the next state if the current success.

state.success_name

Label of the next state if the current successed.

Global(s)

CTask(name, func, fail_name, fail_func, success_name, success_func)

Constructor of the class CTask

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.

#number STATE_FAILED

CONSTANCE For the case the task has failed

#number STATE_NIL

CONSTANCE For the case there is no task on the stack

#number STATE_PENNDING

CONSTANCE For the case the task should run

#number STATE_SUCCESS

CONSTANCE For the case the task has success

Type CTask

Field(s)

CTask.appendArgs(...)

Add the args to the task

Parameter

  • #vars ... : A lot of args.

CTask.appendArgsSwitch(args, fail_args, success_args)

Add the args to the task for a logical switch

Parameters

  • #table args : A lot of args for the default case

  • #table fail_args : A lot of args for the fail case

  • #table success_args : A lot of args for the success case

CTask.getFailArgs()

Return the fails args.

Return value

#table: The requested args of the fails case.

CTask.getFailTask()

Return and generate the task on the fail case

Return value

#CTask: The requested new task.

CTask.getSuccessArgs()

Return the success args

Return value

#table: The requested args of the fails case.

CTask.getSuccessTask()

Return and generate the task on the success case

Return value

#CTask: The requested new task

CTask.getVar(var_name)

Return a custom var for the task

Parameter

  • #string var_name : The name of var

Return value

#var: The request var.

CTask.hasArgsInfo()

Return if the task has args.

Return value

#boolean: True if the task has args, false if not.

CTask.hasFailInfo()

Return if the task has infos about what to do in the fail case.

Return value

#boolean: True if at least a function is there, false if not

CTask.hasSuccessInfo()

Return if the task has infos about what to do in the success case.

Return value

#boolean: True if at least a function is there, false if not

CTask.run()

Run the function for this task

Return value

#CONSTANCE:

CTask.setVar(var_name, var)

Set a custom var for the task

Parameters

  • #string var_name : The name of var

  • #var var : The var which should be saved.

CTask.update()

Update the time for the last finished run of the task

Type CONSTANCE

One of the global CONSTANCE in this file

Type state

Field(s)

#vars state.args

List of args with which the current state will be called.

#vars state.fail_args

List of args with which the next state if the current fail will be called.

#function state.fail_func

Function which are called for the next state if the current fails.

#string state.fail_name

Label of the next state if the current fails.

#number state.last_call

The Time millisec from GetTime() when the last call was.

#number state.last_success

The Time millisec from GetTime() when the last successful call was.

#function state.state_func

Function which are called for the state

#string state.state_name

Label of the state

#vars state.success_args

List of args with which the next state if the current success will be called.

#function state.success_func

Function which are called for the next state if the current success.

#string state.success_name

Label of the next state if the current successed.

Type var

Any type of var including lists

Type vars

One or more incoming argument.