task模块再升级,修复bgm模块没跟上task模块更新的bug

This commit is contained in:
MrZ626
2020-12-07 01:54:32 +08:00
parent 7bed61f210
commit c4d787cb27
3 changed files with 25 additions and 42 deletions

View File

@@ -28,6 +28,7 @@ function TASK.new(code,...)
tasks[#tasks+1]={
thread=thread,
code=code,
args={...},
}
end
end
@@ -38,17 +39,11 @@ function TASK.newNet(code,...)
tasks[#tasks+1]={
thread=thread,
code=code,
args={...},
net=true,
}
end
end
function TASK.changeCode(c1,c2)
for i=#tasks,1,-1 do
if tasks[i].thread==c1 then
tasks[i].thread=c2
end
end
end
function TASK.removeTask_code(code)
for i=#tasks,1,-1 do
if tasks[i].code==code then
@@ -56,9 +51,9 @@ function TASK.removeTask_code(code)
end
end
end
function TASK.removeTask_data(data)
function TASK.removeTask_iterate(func,...)
for i=#tasks,1,-1 do
if tasks[i].data==data then
if func(tasks[i],...)then
rem(tasks,i)
end
end