local hour = 1
local function IsMorning()
if hour < 20 then
print("It's Morning!")
hour = hour + 1
return false
else
print("It's Night!")
return true
end
end
waitbool(IsMorning) --ν¨μμ λ°νκ°μ΄ trueκ° λ λκΉμ§ ν¨μλ₯Ό κ³μ νΈμΆν΄μ
print("Call WaitMessage Function")
local function WaitMessage()
print("wait 3s")
wait(3)
print("Hello DitoLand!")
end
waitfunction(WaitMessage) --ν¨μλ₯Ό νΈμΆν λ€, ν¨μκ° μ’ λ£λ λκΉμ§ κΈ°λ€λ €μ
print("End WaitMessage Function")
local co = coroutine.create(function()
print("Hello!")
end)
local co = coroutine.create(function()
print("Hello!")
end)
coroutine.resume(co)
local co = coroutine.create(function()
for i = 1, 3 do
print("num : " .. i)
coroutine.yield()
end
end)
coroutine.resume(co) -- num : 1
coroutine.resume(co) -- num : 2
coroutine.resume(co) -- num : 3
local co = coroutine.wrap(function()
print("Hello!")
end)
co()
local co = coroutine.create(function()
print("Hello!")
end)
print(coroutine.status(co)) -- suspend
coroutine.resume(co)
print(coroutine.status(co)) -- dead