lua wait code example
Example 1: wait function lua
function wait(seconds)
local start = os.time()
repeat until os.time() > start + seconds
end
Example 2: wait() in lua
wait(5)
print("Hello world!")
Example 3: sleep function lua
local clock = os.clock
function sleep(n)
local t0 = clock()
while clock() - t0 <= n do end
end
Example 4: lua wait function
local function wait(seconds)
local time = seconds or 1
local start = os.time()
repeat until os.time() == start + time
end
Example 5: how to wait in lua
wait()