Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- recieve = function()
- local x = select(2,coroutine.resume(producer))
- return x
- end
- producer = coroutine.create(function()
- local x
- while true do
- while true do
- x = io.read()
- if not tonumber(x) then
- break
- end
- end
- coroutine.yield(x)
- end
- end)
- print("Do not enter a number!")
- while true do print(recieve()) end
Add Comment
Please, Sign In to add comment