What does wait return and why is it relevant?


#1

Documentation for wait() in Built-in Functions & Variables seems to state that two numbers are returned from using a wait(), but it doesn’t say what they are. What are these numbers and why are they relevant?


#2

The first is the time that the call spent yielding, the second is the distributed game time at the time that the call returned.


#3

wait returns how much time has it waited.

Example:

local start = tick()
local w = wait()
local finish = tick()
print(finish-start, w)
--printed: 0.031780481338501 0.031768507404195

Edit: Forgot about 2nd value, refer to @buildthomas 's post.


#4

It’s more accurate to say that the second value is the same as elapsedTime().