error after compiling
Posted: Thu Apr 23, 2015 4:29 am
After compiling this module, UART is disconnected.
Happens only with this code, others are compiled without problems.
Happens only with this code, others are compiled without problems.
Code: Select all
local Serv = {
srv = nil,
script = function(path,params) return "Empty" end,
response = function(self,path,params)
return "<html><body>"..self.script(path,params).."</body></html>"
end,
startServer = function(self,port)
self.srv=net.createServer(net.TCP)
self.srv:listen(port,function(conn)
conn:on("receive",function(conn,request)
local params = {}
local _, _, method, path, vars = string.find(request, "([A-Z]+) /(.+)?(.+) HTTP");
if (vars ~= nil)then for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do params[k] = v end end
conn:send(self:response(path,params))
conn:on("sent",function(conn) conn:close() conn=nil collectgarbage() end)
end)
end)
end,
stopServer = function(self) self.srv:close() end,
}
return Serv