Post your best Lua script examples here

User avatar
By gerardwr
#3828
picstart1 wrote:loaded init.lua from archeif2.zip and got the above error


It looks like there's something gone wrong with your upload mechanism. I have had similar problems before, in my case due to a not perfect power supply.

I use luatool (on this board) myself. It checks during upload the response from the ESP.

Hope this helps.
User avatar
By gerardwr
#3833
zeroday wrote:Thank you, and can I put your code in my examples or demos folder in github someday.
I'm now busy fixing.... :(


Hi zeroday.

Yes, you can put my code as example on github, but I need your help so solve the "final issue" in my webserver code.

It now executes Lua statements that are embedded in a html file, and writes the result to the serial console. But… I have some trouble sending the output that is written to the console ALSO to the web browser. I could really use your help in getting that sorted.

First I tried node.input and node.output but I could not get it working.
Next I tried the execution of a loadstring, that works OK now in my latest code, but sending to the browser I cannot solve yet.

Some posts for background and problem description.
http://www.esp8266.com/viewtopic.php?f=19&t=611&start=60#p3760
http://www.esp8266.com/viewtopic.php?f=19&t=659#p3729
http://www.esp8266.com/viewtopic.php?f=19&t=659

Can you help please. I'm stuck here and it eats up all my time I could spend in finishing the example nicely.
User avatar
By zeroday
#3901
gerardwr wrote:
zeroday wrote:Thank you, and can I put your code in my examples or demos folder in github someday.
I'm now busy fixing.... :(


Hi zeroday.

Yes, you can put my code as example on github, but I need your help so solve the "final issue" in my webserver code.

It now executes Lua statements that are embedded in a html file, and writes the result to the serial console. But… I have some trouble sending the output that is written to the console ALSO to the web browser. I could really use your help in getting that sorted.

First I tried node.input and node.output but I could not get it working.
Next I tried the execution of a loadstring, that works OK now in my latest code, but sending to the browser I cannot solve yet.

Some posts for background and problem description.
http://www.esp8266.com/viewtopic.php?f=19&t=611&start=60#p3760
http://www.esp8266.com/viewtopic.php?f=19&t=659#p3729
http://www.esp8266.com/viewtopic.php?f=19&t=659

Can you help please. I'm stuck here and it eats up all my time I could spend in finishing the example nicely.


well I have been follow you posts everyday.
but I have no solutions in lua way, me a lua newbie too. :oops:
the first thing came into my head, is to make a api in C to do this,
take a lua statement, run it, and return a string result... but this is ugly...