lostgallifreyan wrote:
> I'm guessing I'll have to compile Lua with LuaSocket but I think I
> can do it, I managed to compile my copies of v5.1.4 Lua and Luac and
> Lua.dll with TCC compiler, so that could be a nice way to go. On the
> other hand, that means console windows popping up, and for something
> like a web proxy based filter system it's nice if it runs very much
> in the background. If I try both I'll learn more though.

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).

[1] http://luabinaries.luaforge.net/index.html

Here is the same example implemented using wxLua:

function Main()
        local ip = wx.wxIPV4address()
        -- localhost
        print(ip:AnyAddress())
        print(ip:Service(8080))
        local socket = wx.wxSocketServer(ip, wx.wxSOCKET_WAITALL)
        print(socket:Ok())

        local data
        while 1 do
                data = {}
                print("waiting...")
                local client = socket:Accept(true)
                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     
end

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to