Post your best Lua script examples here

User avatar
By alonewolfx2
#3371
gerardwr wrote:Hi,
My example was downloaded almost 50 times, but without any response from the downloaders :?

I'm not here for personal glory, but would appreciate suggestions, either positieve OR critical.

I have extended the webserver part of the example. It now displays all files present on the ESP in a clickable link. Clicking on a .HTML file displays this file in the browser. Clicking on a .LUA file will execute LUA statements in it (in development). I'm still pondering on embedding LUA statements in a HTML file, like CGI.

Anyone interested in followups or have some suggestions.

firstly thank you for your example.
i tried your exmple and it worked but its not stable for me. chip crashing After receiving 4-5 request. i dont know why. have you any idea?
User avatar
By gerardwr
#3374
alonewolfx2 wrote:firstly thank you for your example.
i tried your exmple and it worked but its not stable for me. chip crashing After receiving 4-5 request. i dont know why. have you any idea?


A user!, yay!

Thanks for your feedback.

From the early day I recognize the behavior you describe, crashing after 4-5 requests, especially when the time between requests was short. Every request eats up heap space, and I believe the Garbage Collection to clean up acts on a timer every minute or so? When the heapspace is too low (I read somewhere around 3000 bytes) the ESP resets.

I'm now testing the webserver WITHOUT the GPIO/ADC reporting, that saves some heap space. In the current version it's rather stable now for me, but I do not remember making any special corrections for stability reasons. Sometimes you solve a problem that you did not know it existed ;)

I did a check 1 minute ago. I requested the "home page" every 50 times with a 1 second delay between refreshes and it did not crash. The page came up OK every time.

Home page looks like this now, it's not pretty, but hey "it works". The "funny lines" after the "Page type" lines is the result from the HMTL code in the .HTML file.

Schermafbeelding 2014-11-27 om 14.47.05.png