deferAtIndex

fun <T : Task?> deferAtIndex(index: Int, @NonNull newDynamicTask: Supplier<T>): T

Insert a task at a specific index in the queue. This is useful for adding tasks that should be run at a specific point in the autonomous sequence. Note that this function immediately produces side effects, and subsequent calls will not be able to insert tasks at the same index due to the shifting of tasks.

This task will be internally wrapped into a DynamicTask.

Return

the added task

Parameters

index

the index to insert the task at, starting from 0

newDynamicTask

deferred task to add to the run queue

<T>

the inherited task type