forked from Tencent/UnLua
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path07_CallLatentFunction.lua
More file actions
Latest commit
28 lines (22 loc) · 749 Bytes
/
Copy path07_CallLatentFunction.lua
File metadata and controls
28 lines (22 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--[[
说明:在Lua协程中可以方便的使用UE4的Latent函数实现延迟执行的效果
]]--
localScreen=require"Tutorials.Screen"
localM=UnLua.Class()
localfunctionrun(self, name)
Screen.Print(string.format("协程%s:启动", name))
fori=1, 5do
UE.UKismetSystemLibrary.Delay(self, 1)
Screen.Print(string.format("协程%s:%d", name, i))
end
Screen.Print(string.format("协程%s:结束", name))
end
functionM:ReceiveBeginPlay()
localmsg=[[
—— 本示例来自 "Content/Script/Tutorials.07_CallLatentFunction.lua"
]]
Screen.Print(msg)
coroutine.resume(coroutine.create(run), self, "A")
coroutine.resume(coroutine.create(run), self, "B")
end
returnM