diff --git a/lua_examples/webap_toggle_pin.lua b/lua_examples/webap_toggle_pin.lua index 37896263..7d5a558d 100644 --- a/lua_examples/webap_toggle_pin.lua +++ b/lua_examples/webap_toggle_pin.lua @@ -1,32 +1,31 @@ -wifi.setmode(wifi.SOFTAP); -wifi.ap.config({ssid="test",pwd="12345678"}); +wifi.setmode(wifi.SOFTAP) +wifi.ap.config({ssid="test",pwd="12345678"}) gpio.mode(1, gpio.OUTPUT) -srv=net.createServer(net.TCP) -srv:listen(80,function(conn) +srv=net.createServer(net.TCP) +srv:listen(80,function(conn) conn:on("receive", function(client,request) - local buf = ""; - local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP"); - if(method == nil)then - _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP"); + local buf = "" + local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP") + if(method == nil)then + _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP") end local _GET = {} - if (vars ~= nil)then - for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do - _GET[k] = v - end + if (vars ~= nil)then + for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do + _GET[k] = v + end end - buf = buf.."