summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Server/Plugins/.gitignore1
-rw-r--r--Server/Plugins/MultiThreadTest/init.lua40
2 files changed, 41 insertions, 0 deletions
diff --git a/Server/Plugins/.gitignore b/Server/Plugins/.gitignore
index 99844d3a0..b742adb70 100644
--- a/Server/Plugins/.gitignore
+++ b/Server/Plugins/.gitignore
@@ -5,3 +5,4 @@
!/HookNotify
!/NetworkTest
!/TestLuaRocks
+!/MultiThreadTest \ No newline at end of file
diff --git a/Server/Plugins/MultiThreadTest/init.lua b/Server/Plugins/MultiThreadTest/init.lua
new file mode 100644
index 000000000..f2c4fe6d5
--- /dev/null
+++ b/Server/Plugins/MultiThreadTest/init.lua
@@ -0,0 +1,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