August 26, 2021, 4:28pm
I was wondering since now that
task.spawn is a viable option whether it was still worth using coroutines or not.
The first advantage I can think of with
task.spawn is that it actually has a debug traceback, while a coroutine locks that behind
“Error at line 1”.
But, they do accomplish the same thing. What do y’all think?
Did you find out the answer to your question I am also wondering too.
September 23, 2021, 5:38pm
No. All I learned was that the advantage of
task.spawn returning a debug traceback wasn’t actually an existing advantage. I was testing with some of my programs, and I had an error inside of a
task.spawn which didn’t print to the console.
September 23, 2021, 6:23pm
I personally would always prefer
coroutine.wrap. You can even create your own
wrap function that uses
local function wrap(fn)
local thread = coroutine.create(fn)
Not sure why you’d want to do that, but you could.
The biggest reason is stack trace, as you mentioned before.
October 17, 2021, 10:03am
task.spawn just slightly slower then corontine according to benchmark tests i saw on the new task library post