This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Joe2987's profile picture

[Lua] [Error] Coroutine limit of 50 reached.

Started by Joe2987, 29 October 2012 - 07:33 AM
Joe2987 #1
Posted 29 October 2012 - 08:33 AM
I've been writing an IRC-like chat program using rednet. I've gotten this far using the wiki, but I've got two problems now:
1) When too many (50?) messages are sent or received, the program errors out with

parallel:4: Coroutine limit of 50 reached.
2) The Ping/User ID system doesn't communicate with other computers/users well. Sometimes it only returns one other user (besides the local user), sometimes it returns none. I'm sorry I'm so vague on this one, but I have no idea where the actual problem is, other than that it's somewhere in GetUser() or Receive().

The first one just sorta cropped up while I was testing. The second one, I've been working on all day, to no avail. I'd really appreciate it if I could get some input on either or both problems.

The code for the program itself is here:
http://pastebin.com/XSe7MJ3i

Thanks.
BigSHinyToys #2
Posted 29 October 2012 - 09:54 AM
every time you call parallel.waitForAny(Receive, Send) it creates two coroutines when 50 is reached it gives that error

do this
http://pastebin.com/JhNTypg0

that way to loops are in the coroutines and it wont constantly make new coroutines
Joe2987 #3
Posted 29 October 2012 - 09:39 PM
Thanks. I thought parallel.waitForAny() would close its coroutines after using them. Guess I was wrong. I'm still confused about the UID system, since it should work, but I'm playing with the code right now, so hopefully I'll find something that works.