Skip to main content

Routine

Description:

  A singleton record for managing coroutines.

Teal Type: {Job}.

Job

Type: Field.

Description:

  An alias for a coroutine thread.

Signature:

type Job = thread

remove

Type: Function.

Description:

  Remove a coroutine job from the set and close it if it is still running.

Signature:

remove: function(self: Routine, job: Job): boolean

Parameters:

ParameterTypeDescription
jobJobThe Job instance to remove.

Returns:

Return TypeDescription
booleanTrue if the job was removed, false otherwise.

clear

Type: Function.

Description:

  Remove all coroutine jobs and close them if they are still running.

Signature:

clear: function(self: Routine)

__call

Type: Metamethod.

Description:

  Metamethod to add a new Job to the Routine.

Signature:

metamethod __call: function(self: Routine, job: Job): Job

Parameters:

ParameterTypeDescription
jobJobThe Job instance to add.

Returns:

Return TypeDescription
JobThe Job instance that was added.