{"action":"created","issue":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/369","labels_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/369/labels{/name}","comments_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/369/comments","events_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/369/events","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/369","id":69214147,"number":369,"title":"coroutine.yield()","user":{"login":"drv53b6","id":1354115,"avatar_url":"https://avatars.githubusercontent.com/u/1354115?v=3","gravatar_id":"","url":"https://api.github.com/users/drv53b6","html_url":"https://github.com/drv53b6","followers_url":"https://api.github.com/users/drv53b6/followers","following_url":"https://api.github.com/users/drv53b6/following{/other_user}","gists_url":"https://api.github.com/users/drv53b6/gists{/gist_id}","starred_url":"https://api.github.com/users/drv53b6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drv53b6/subscriptions","organizations_url":"https://api.github.com/users/drv53b6/orgs","repos_url":"https://api.github.com/users/drv53b6/repos","events_url":"https://api.github.com/users/drv53b6/events{/privacy}","received_events_url":"https://api.github.com/users/drv53b6/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-17T20:43:57Z","updated_at":"2015-04-24T14:55:25Z","closed_at":null,"body":"i have this code:\r\n```LUA\r\nlocal tr\r\nlocal function onSent(c, pl)\r\n   local trSt = coroutine.status(tr)\r\n   print(\"sent\",tr,trSt)\r\n   if trSt == \"suspended\" then\r\n      coroutine.resume(tr)\r\n   end\r\nend\r\nlocal function on_response(connection)\r\n  c=connection\r\n  coroutine.yield() -- this yield alweys ok, status alweys \"suspended\"\r\n  dofile(\"print_main_page.lc\")\r\n  c=nil\r\nend\r\ntr = coroutine.create(on_response)\r\nconn.tread=tr\r\nc:on(\"sent\", onSent)\r\ncoroutine.resume(tr, connection)\r\n```\r\nand inside \"print_main_page.lua\" have as 1st string:\r\n```LUA\r\n  coroutine.yield() -- after this yield tread status alweys \"dead\"\r\n  c:send(\"<html>\")\r\n```\r\n1st yield ok, 2nd yield cannot well worck"},"comment":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/comments/95954499","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/369#issuecomment-95954499","issue_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/369","id":95954499,"user":{"login":"TerryE","id":690173,"avatar_url":"https://avatars.githubusercontent.com/u/690173?v=3","gravatar_id":"","url":"https://api.github.com/users/TerryE","html_url":"https://github.com/TerryE","followers_url":"https://api.github.com/users/TerryE/followers","following_url":"https://api.github.com/users/TerryE/following{/other_user}","gists_url":"https://api.github.com/users/TerryE/gists{/gist_id}","starred_url":"https://api.github.com/users/TerryE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TerryE/subscriptions","organizations_url":"https://api.github.com/users/TerryE/orgs","repos_url":"https://api.github.com/users/TerryE/repos","events_url":"https://api.github.com/users/TerryE/events{/privacy}","received_events_url":"https://api.github.com/users/TerryE/received_events","type":"User","site_admin":false},"created_at":"2015-04-24T14:55:25Z","updated_at":"2015-04-24T14:55:25Z","body":"@drv53b6, the nodeMCU eLua model is event driven.  Use the event system to implement concurrency.  Coroutining across event threads won't work.  "}}