ual.lua 558 B

1234567891011121314151617181920212223242526
  1. local function storelist(table)
  2. file.remove("http/aplist.json")
  3. file.open("http/aplist.json","w")
  4. file.write(cjson.encode(table))
  5. file.close()
  6. print(cjson.encode(table))
  7. coroutine.yield()
  8. table = nil
  9. end
  10. local function sendHeader(connection)
  11. connection:send("HTTP/1.0 200 OK\r\nContent-Type: application/json\r\nCache-Control: private, no-store\r\n\r\n")
  12. connection:send('{"error":0, "message":"OK"}')
  13. end
  14. return function(connection,args)
  15. sendHeader(connection)
  16. wifi.sta.getap(storelist)
  17. end