Well, to be exact, I want to know how to check for the time it took for a function to run and get the time it took for the function to run. Is it possible to do that, and if so how?
✓ ANSWER ACCEPTED
Is It Possilbe To Check For Wait Time Once A Function Is Done Running?
1 answer
✓ Accepted answer
You can get the current time using tick(). It returns the number of seconds that have passed since some time in history.
If I check the time now,
local before = tick() --> 1400
I do some work, and then I check back later:
local after = tick() -- 1500
I can see how much time has elapsed by taking the difference: after - before --> 100 seconds.
local before = tick()
do_some_work()
local elapsed = tick() - before
print("it took " .. elapsed .. "s to do_some_work")
This discussion is preserved as it was. New answers, comments, and votes are closed.
