Is there a difference between task.deferring the current thread and doing task.wait()?

Hi,

I’m wondering if there’s a difference between doing task.defer on the current thread and doing task.wait()? I’ve tried googling it to no avail as there aren’t really many topics on task.defer.

Basically to give a brief summary there are certain cases where I need to defer the current thread if possible, but I’ve found that I’m doing it enough to need to make a custom handler to get the current active thread and defer it (namely to wait for certain events which handle themselves independently to disconnect themselves), reparenting things (since immediately parenting causes parent errors), among a few other things. Ideally I want to wait the smallest amount of time as possible, so I’ve resorted to deferring the current thread, but then it occurred to me, why wouldn’t this be a built-in feature? I’ve used it several times, and would think other people have as well. So I’m now thinking task.wait() is the same as deferring the current thread. Can anyone confirm or deny this? The function in task.defer isn’t passed any arguments unless explicitly passed after passing the thread/function so I’m not able to compare any “delta” with the result of task.wait.

TLDR I’m just wondering if there’s a difference between doing:

task.defer(coroutine.running())
coroutine.yield()

and doing:

task.wait()