What does wait return and why is it relevant?

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?

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

11 Likes

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.

1 Like

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

1 Like