blob: f2c4fe6d5e0eb0fa46e32c0c195bd7af68641b2e (
plain) (
blame)
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
29
30
31
32
33
34
35
36
37
38
39
40
|
local PLUGIN_NAME = "MultiThreadTest";
function Initialize(a_Plugin)
a_Plugin:SetName(PLUGIN_NAME)
cPluginManager:BindConsoleCommand("startthread", HandleStartThreadCommand, "");
LOG("Initialized");
return true;
end
function Callback()
cRoot:Get():GetDefaultWorld():QueueTask(function()
print("From world thread");
end);
end
function HandleStartThreadCommand(a_Split)
cThread.new(function()
print("Test");
for i = 1, 5 do
cThread.sleep(1);
print("Testing", i);
end
-- Really ugly way to return to the default lua_State
cPluginManager:CallPlugin(PLUGIN_NAME, "Callback");
end)
return true;
end
|