mirror of
https://github.com/rayaman/multi.git
synced 2026-09-05 07:27:35 -04:00
Rewriting love2d threading binding
This commit is contained in:
+23
-3
@@ -1,7 +1,7 @@
|
||||
package.path = "../?/init.lua;../?.lua;"..package.path
|
||||
local multi, thread = require("multi"):init()
|
||||
|
||||
local GLOBAL, THREAD = require("multi.integration.loveManager"):init()
|
||||
GLOBAL, THREAD = require("multi.integration.loveManager"):init()
|
||||
|
||||
GLOBAL["Test"] = {1,2,3, function() print("HI") end}
|
||||
|
||||
@@ -10,8 +10,28 @@ for i,v in pairs(GLOBAL["Test"]) do
|
||||
if type(v) == "function" then v() end
|
||||
end
|
||||
|
||||
multi:newAlarm(3):OnRing(function()
|
||||
GLOBAL["Test2"] = "We got a value!"
|
||||
local test = multi:newSystemThread("Test",function()
|
||||
print("THREAD_ID:",THREAD_ID)
|
||||
GLOBAL["Test2"] = "We did it!"
|
||||
eror("hahaha")
|
||||
return 1,2,3
|
||||
end)
|
||||
|
||||
test.OnDeath(function(a,b,c)
|
||||
print("Thread finished!",a,b,c)
|
||||
end)
|
||||
|
||||
test.OnError(function(self, err)
|
||||
print("Got Error!",err)
|
||||
end)
|
||||
|
||||
local func = THREAD:newFunction(function(a,b,c)
|
||||
print("let's do this!",1,2,3)
|
||||
return true
|
||||
end)
|
||||
|
||||
func(1,2,3).OnReturn(function(ret)
|
||||
print("Done",ret)
|
||||
end)
|
||||
|
||||
thread:newThread(function()
|
||||
|
||||
Reference in New Issue
Block a user