Basically I wanna know, are functions threads? and can they be put through coroutine.close() to close them?
I wanna know this because I’m planning to make a system where I can access every move a person is do it and manage it however I want to.
Basically I wanna know, are functions threads? and can they be put through coroutine.close() to close them?
I wanna know this because I’m planning to make a system where I can access every move a person is do it and manage it however I want to.
When you call a function the CPU starts executing instructions at another location in memory, so the answer is no.
You can put a function on a separate thread by using coroutine.create (or some of the other methods)
local thread = coroutine.create(function()
while task.wait() do
print("Thread is looping")
end
end)
coroutine.resume(thread) -- starts thread
task.wait(2)
coroutine.close(thread) -- kills thread
(simplified the technical stuff a bit so it might not be 100% accurate)
No, but they can become their own threads by being wrapped in one (this includes Roblox’s ECS “Signal/Connection” system) or being fired on a new Actor. Threads are typically containers for functions and they are not the same thing.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.