Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way how to shorthand a coroutine?

Lets say I want to have a process run in the background once, and I don't need to reference it later.

Is it possible to create a coroutine without a key variable?

like how you can call a function like

function() 
--do somehting
end

Is there a way to do this with coroutines? I'd imagine it would be along the lines of

coroutine.resume(coroutine.create(function()
--do something
end))

1 comment

1

you have it right there. what is your question?

2 answers

✓ Accepted answer

You can do things such as using spawn() or delay(), but there is no actual coroutine.resume(coroutine.create()) direct shorthand.

Actually there is a way to shorthand it: coroutine.wrap The way to use it would be

local example = coroutine.wrap(function()
print ("a")
end)

Basically it takes a coroutine and assigns it a function. To use it you would just call the function you assigned to it with whatever parameters requires. Hope this helps. :)

1 comment

0

I'm kinda looking to skip the assigning feature and just run it without any assigning needed.

This discussion is preserved as it was. New answers, comments, and votes are closed.