xxxxxxxxxx
local function Wait(s)
local c = os.time()
repeat until c >= c + s
end
xxxxxxxxxx
function wait(seconds)
local start = os.time()
repeat until os.time() > start + seconds
end
--Exactly the same as the roblox one!
xxxxxxxxxx
function wait(seconds)
local start = os.time()
repeat until os.time() > start + seconds
end
-- This is the wait function (mostly known from roblox)
-- It works exactly like the roblox version
-- It's used like this: wait(how many seconds)
xxxxxxxxxx
function wait(n)
os.execute("sleep "..tostring(tonumber(n)))
end
-- the reason we're doing this is because lua
-- doesn't have a built in wait function
-- unless it's roblox lua or other types,
-- but this is for vanilla lua
xxxxxxxxxx
wait(5) -- Waits 5 seconds then prints "Hello world!"
print("Hello world!")
xxxxxxxxxx
--this is a example of wait
print("gonna wait some seconds so i can talk again")
wait(2) --wait 2 sec
print("now can i say something")
xxxxxxxxxx
--example of wait()
local number = 1
wait(number) --it will wait the varible number
local newnumber = number + number --result = 2
wait(newnumber) --can add numbers too
print("okay the script is over. i waited 3 sec") -- you can delete this
--wait is used to wait some seconds.
--you can do this too
wait(0.1)
wait(0.002938234)
wait(0.9999)
--the 3 numbers are now below 1 sec
--it works like this : wait(seconds)
xxxxxxxxxx
function wait(s)
s = s or 0.5
local start = os.clock()
repeat until os.clock() > start + s
end
wait(50)
print("hi")
--better for if you want a decimal point or if you want to do "wait()"