So I took the new webserver example, added a counter - and checked for an argument like www.mysite.com/?myarg=HELLO
Looked up the LUA docs - found the way to do it and
> mycounter=0
> srv=net.createServer(net.TCP)
> srv:listen(80,function(conn)
>> conn:on("receive",function(conn,payload)
>> if string.find(payload,"?myarg=") then
>> mycounter=mycounter+1
>> m="<br/>Value= " .. string.sub(payload,string.find(payload,"?myarg=")+7,string.find(payload,"HTTP")-2)
>> else
>> m=""
>> end
>> conn:send("<h1> Hello, this is Pete's web page.</h1>How are you today.<br/> Count=" .. mycounter .. m)
>> end)
>> conn:on("sent",function(conn) conn:close() end)
>> end)
>
Absolutely GREAT... but ran it a dozen times, the counter worked, the argument came back and then.... I have NO idea why it crashed.
> c_GORSvfJSz.Szfn
Pete's LUA module 0.1
NodeMcu 0.9.2 build 20141120 powered by Lua 5.1.4
>
Loading functions
Connecting
Connected to.loft-east.IP:.0.0.0.0
OK