Hey, so I'm making a very complicated script with a lot of functions, but always something has to execute after that function, and instead of using wait() , I wanted to know if is there a better way to detect when a function is over executing in order to do something else, in the exact time that the function stopped?
✓ ANSWER ACCEPTED
How to detect when a function is over?
1 answer
✓ Accepted answer
The code below a function call won't run until the function finishes. The only exception is when you use spawn().
local function foo()
local i = 0
while i < 10000 do
i = i + 1
end
print(i)
end
foo()
print"this won't print until foo finishes running"
5 comments
0
Thanks
0
wait you can use a print without parenthesis? or is it just a typo?
0
you dont parantheses when using string
0
Functions can be called with string "" or table {} constructors, while passing that data to the function call as the first argument.
0
Ya this is syntactic sugar for a function call ^ but isn't so sweet as Lua PIL says it is
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
What you need is a coroutine boi