I am trying to use luasocket to connect to an Irc channel and send and receive messages within my game (Wolfenstein Enemy Territory, If that helps).
Right now I am able to do all of that, with one problem. Once I set it to listen for a message, it basically locks up. I have a fallback command if I type stoplisten in Irc it just stops the script, And I can see it got all the message, but the game itself is locked up while waiting for the messages.
Any Ideas on how I would do this without freezing the game? I have just recently learned a little of coroutines So I do not know if I am using them correctly. I should also note I have access to a run frame functions which runs every millisecond if that helps (Though normally it is done like: if math.mod(currentTime, 50) ~= 0 then return end)
Here is the part in my code: http://pastebin.com/j1gCqm4R (I wasnt gonna edit all my code with an indent just to post it here, so i just put it on pastebin)