From: Andreas K. <and...@gm...> - 2009-10-25 20:15:04
|
lostgallifreyan wrote: > Andreas Krinke wrote: >> You should be able to use binaries for Lua [1]. In the Lua for >> Windows package there is a wlua.exe that doesn't pop up a console >> window (if I remember correctly). > > I'll check that out. Very useful. I also think that TCC might be > persuaded to compile such that Lua runs without a console. I didn't > explore because at the time I think it demanded more than I knew. > Probably still does but next time I look at using TCC I'll try that. http://luabinaries.luaforge.net/manual.html says LuaBinaries provides a wlua5.1.exe without a console, so no need for Lua for Windows. > One thing I read yesterday was that Windows can have > difficulties with socketry that isn't done in the main thread, but as > far as I know, in wxLua the message loop means event driven > conditions allow many connections to be handled without > multithreading. Is it as simple and efficient as it sounds, or am I > missing something I need to know at the outset before trying things? Sorry, can't help you with that. > One other thing just cropped up.. While I was writing this, I'd left > wxLua running the above code, and some time after I'd closed Firefox > a wxLua error message came up stating that variable 'client' had > become a nil value when indexed on line 15 (client:Read(1)). Any > advice on prevention? Try this change: local client = socket:Accept(true) if client then repeat data[#data+1] = client:Read(1) until data[#data] == "\n" print(table.concat(data)) client:Write([[ <html> <body> <h1>wxLua Proxy Test</h1> </body> </html> ]]) client:Close() end |