I think the default in LuaSocket is to do "blocking" calls, hence your delay. Coroutines, per se, are not going to change that. It depends what you are trying to achieve, I think the library itself allows asynchronous IO, however it can be a little fiddly because MUSHclient itself has a "main loop" where it looks for incoming TCP data, and to have another point (in LuaSocket) where it also looks for TCP data is going to have two "choke points" so to speak.
Ircria said:
Also, I was wondering about how MUSHclient includes the main lua file. Would there be any issues if I used luac to compile my script file into bytecode?
It loads the main Lua file "the usual way". You can precompile it if you want. I just tested that and it worked OK. I'm not sure why you would bother, it makes changing scripts harder, and you don't save much time, but in principle you can do it. |