From de121b6dfa31a9961446c97733a228af8bbb3247 Mon Sep 17 00:00:00 2001 From: Artem Pastukhov Date: Tue, 31 Mar 2015 14:54:31 +0300 Subject: [PATCH] Add ual.lua --- http/ual.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 http/ual.lua diff --git a/http/ual.lua b/http/ual.lua new file mode 100644 index 0000000..301ff2a --- /dev/null +++ b/http/ual.lua @@ -0,0 +1,26 @@ +local function storelist(table) + file.remove("http/aplist.json") + file.open("http/aplist.json","w") + file.write(cjson.encode(table)) + file.close() + print(cjson.encode(table)) + coroutine.yield() + table = nil +end + + + + + + +local function sendHeader(connection) + connection:send("HTTP/1.0 200 OK\r\nContent-Type: application/json\r\nCache-Control: private, no-store\r\n\r\n") + connection:send('{"error":0, "message":"OK"}') +end + + + +return function(connection,args) + sendHeader(connection) + wifi.sta.getap(storelist) +end