Love2d newFunction working

This commit is contained in:
Ryan Ward 2022-04-10 20:00:20 -04:00
parent d8aeefd202
commit 79f58a79f9

View File

@ -62,23 +62,22 @@ function multi:newSystemThread(name,func,...)
GLOBAL["__THREAD_COUNT"] = THREAD_ID GLOBAL["__THREAD_COUNT"] = THREAD_ID
THREAD_ID=THREAD_ID + 1 THREAD_ID=THREAD_ID + 1
thread:newThread(function() thread:newThread(function()
while true do thread.hold(function()
thread.yield() return not c.thread:isRunning()
if c.stab["returns"] then end)
c.OnDeath:Fire(c,unpack(t.stab.returns)) print("Thread: "..name.." finished executing...")
t.stab.returns = nil -- If the thread is not running let's handle that.
thread.kill() local thread_err = c.thread:getError()
end if thread_err == "Thread Killed!\1" then
local error = c.thread:getError() print("Killed...")
if error then
if error:find("Thread Killed!\1") then
c.OnDeath:Fire(c,"Thread Killed!") c.OnDeath:Fire(c,"Thread Killed!")
thread.kill() elseif thread_err then
else print("Error...",thread_err)
c.OnError:Fire(c, error) c.OnError:Fire(c,thread_err)
thread.kill() elseif c.stab.returns then
end print("Returns",unpack(c.stab.returns))
end c.OnDeath:Fire(c,unpack(c.stab.returns))
c.stab.returns = nil
end end
end) end)
return c return c