Post your best Lua script examples here

User avatar
By Ralphxyz
#19400 [url="http://esp8266.co.uk/recipes/blink-demo/]Tutorial doesn't work[/url]

The local variables are out of scope by the time they are trying to be used.

If you make the variables Global it works.

You would think that people taking the time to publish a tutorial would take the time to test their code.

Or maybe there have been changes since the published, in that case they should follow up and fix their previously working code.

Every language I have tried to learn from the web has had none working "tutorials".

Most I gave up on.
User avatar
By TerryE
#19486 Ralph, having a rant doesn't help. The ESP modules cost a few $s. The SDK and Lua firmware are free. Everything is done on a very tight budget or pro bono. The Arduino boards have a superb support bundle but the Arduino team have gone down a different route of adding maybe $15 per board / module to pay for this.

The main dev teams for both the ESP8266 and nodMCU are Chinese. English is at best a second language for there guys, so please show some toleration and bear with the community volunteers who are trying to improve things -- or learn Chinese and ask your Qs on the nodeMCU forum -- or buy yourself another chipset.

By the way pin and value are what are called upvalues and yes they remain in scope through some Lua magic. See my FAQ for an explanation or read Ierusalimsky's book. I provide info on where you can buy it.