cobra_tomtrein

Untitled

Jul 16th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. function appTask()
  2. local app-list = {}
  3. while true do
  4. local evt = {os.pullEventRaw}
  5. if evt[1] == "openApp" then
  6. local co = {co=coroutine.create(appEngine.launch)}
  7. co.trg = coroutine.resume(co.co,evt[2])
  8. app-list[#app-list+1] = co
  9. else
  10. local co = app-list[#app-list]
  11. if co.trg == nil or co.trg == evt[1] or evt[1] == "terminate" then
  12. co.trg = coroutine.resume(co.co)
  13. end
  14. end
  15. if coroutine.status(app-list[#app-list].co) == "dead" then
  16. app-list[#app-list] = nil
  17. end
  18. end
  19. end
Advertisement
Add Comment
Please, Sign In to add comment