Post your best Lua script examples here

User avatar
By bradvoy
#6341 Interesting. I'm not seeing that problem when uploading via ESPlorer v0.1 build 205. That line is valid LUA syntax, so I think it must be a problem with LuaLoader.

You can change that line to "x = request.query.x", which is equivalent.
User avatar
By picstart
#6355
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > stdin:1: ')' expected near ']'
> > > > > > > > > > > > > > > > > > > > > > = node.heap()

same error with the uploader esp8266 lualoader 0.70 after commenting out x = request.query["x"]
removing the line x = request.query["x"] allows the uploader to upload and the code works using the equivalent x = request.query.x

This a good evidence of an issue with the uploader esp8266 lualoader 0.70
See below
pages = {}
pages["/test"] = function(request)
return "<html><head><title>Web Test</title></head><body><h1>Web Test</h1><body>Request received: " .. request.method .. " " .. request.url .. "</body></html>"
end
pages["/test2"] = function(request)
x = request.query.x
--x = request.query["x"]
x2 = x * x
return "<html><head><title>Square</title></head><body><p>" .. x .. " squared is " .. x2 .. ".</p></body></html>"
end
User avatar
By Mike
#6403 Great work !

After resolving some struggles with the upload this was the first httpserver which left enogh resources to write some Extensions (Beep, usw PWM etc.) without crashing the nodeLua !

Thanks for sharing!!!
User avatar
By jankop
#6512 I ran into a problem with the length of the HTML page during testing, . With a longer page server did not work. But with the new Lua (build 20150106) already it works perfectly. It's just a detriment that is not integrated parser for POST request too.