Small coroutine fix

This commit is contained in:
Robert Jelic
2025-04-06 06:51:43 +02:00
parent a307f58dfb
commit 0a597e63f1
5 changed files with 18 additions and 12 deletions

View File

@@ -238,13 +238,15 @@ local function updateEvent(event, ...)
end
for _, func in ipairs(basalt._schedule) do
if(event==func.filter)or(func.filter==nil)then
local ok, result = coroutine.resume(func.coroutine, event, ...)
if(not ok)then
errorManager.header = "Basalt Schedule Error"
errorManager.error(result)
if(coroutine.status(func.coroutine)=="suspended")then
if(event==func.filter)or(func.filter==nil)then
local ok, result = coroutine.resume(func.coroutine, event, ...)
if(not ok)then
errorManager.header = "Basalt Schedule Error"
errorManager.error(result)
end
func.filter = result
end
func.filter = result
end
if(coroutine.status(func.coroutine)=="dead")then
basalt.removeSchedule(func.coroutine)