Post your best Lua script examples here

User avatar
By RichardS
#3433 You guys should try and post these type things also in the Examples section as individual, they are very nice examples! Good Work!

Richard.
User avatar
By gerardwr
#3445 It's not rocket science, but still funny what HTML can do, also on a small device like e ESP.

Enough fun for now, My assignment for today is cleaning up the code, remove all rubbish from the homepage, and just rely on .html files. And test if the Lua server Side scripts inlide HTML files are feasible.

Will let you know how it goes.
User avatar
By gerardwr
#3489 I upload an intermediate source, because I'm stuck with some HW problems (Often my ESP's will not Restart to the Lua prompt but only display rubbish in the terminal. By Resetting the ESP it generally comes alive after a few HW resets, but not anymore! I power it from an FTDI usb-serial adapter with a 33uF elco across the power terminals, I suspect that's the culprit)

In the upload is the latest webserver.lua to upload to init.lua. I continued with the version that was modified by alonewolfx2:
- some cleaning of the code
- javascript lines added by alonewolfx2 are commented out, don't need them now
- .html files are now presented below the header of the (debug) page between horizontal lines, for better appearance
- lua script lines embedded in html source iarerecognised, but NOT yet interpreted an NOT yet executed. File htmllua.html is such a file, can be used for testing. NOTE : these are the lines I was working on before my HW quit.

The latest version I could test looked like:
Schermafbeelding 2014-11-28 om 23.44.45.png


Hope to get my HW problems resolved tomorrow and continue the execution of the lua lines in the HTMl file. I currently have no clue IF and HOW I can get it done. I know there's a lua statement that executes a lua command in a file, so that's hopefully easy. Getting the result from this execution and send it to the browser is the challenge. Perhaps in hindsite it will look simple.

Tips for that, anyone??

Come on guys! The file was downloaded over 100+ times, but only a response from 1 or 2 guys. Don't let alonewolfx2 and me do all the work, step in!! :mrgreen:

(2.68 KiB) Downloaded 289 times