Post your best Lua script examples here

User avatar
By ChrixXenon
#7638 Thanks again for trying to help me, but that doesn't work either, and it's nothing like NodeMCU's own example from their website (which also doesn't work). I don't mind working hard to learn a thing, but like seems like an excellent way to waste my time, so I think I'll wait until it all stabilises.

Thanks again.
User avatar
By gwizz
#7642 I totally understand wanting to wait a few weeks or months until things stabilise - but I don't think you will gain this by using the 'official' firmware! After all, it has been updated maybe 3 or 4 times in the last six weeks! :D

btw I haven't found any errors in the lua examples beyond the ones I introduced myself - if you can be more specific about bugs then please do report them, the author(s) are very responsive and seem very motivated to do the best job they can.

Now Espressif have released a RTOS firmware - seems already the AT firmware is getting less attention going forward??

If you feel that the learning curve for C++ is easier than for lua - go right ahead and knock yourself out!!

Personally, as a very bad programmer, I am really glad that we can work in a high-level language like lua rather than have to try to learn to talk like a machine in C++. I have looked at some sample C++ code and I can't understand it much at all - whereas with lua I feel like I can get the drift, even though I don't really have much command of the language (yet!).

For me, amazingly terse syntax (like C++) is not a good thing. It just makes the language hard to read. Sure, if you already know C, then perhaps it is not so hard to wrap your head around. And perhaps, also, if you are an experienced programmer in procedural languages then getting used to the functional style and asynchronous nature of lua may be harder than if you don't know much about anything (like me!).

At the end of the day, you have your own time to call, and decide how you would like to waste it! I like wasting it on lua on the ESP8266 (you could probably guess this by now!) :D
User avatar
By lightbulb
#7682
ChrixXenon wrote:Thanks again for trying to help me, but that doesn't work either, and it's nothing like NodeMCU's own example from their website (which also doesn't work). I don't mind working hard to learn a thing, but like seems like an excellent way to waste my time, so I think I'll wait until it all stabilises.

Thanks again.


I tested the code I posted above late last night - worked right off the bat == so you must have problems with your environment.
That code is to connect to google internet servers - are you sure your module is "online". i.e is your module registered with your router etc (can you router provide its MAC address??). Is it "allowed" to access the internet using TCP, ports HTTP and DNS? Does your router provide corrent DNS server addresses to clients (module) so that DNS can be used correctly??
Like I said - environment and/or user error i think.

Check and confirm the above, and if you cant resolve, come back and we will help you do deeper troubleshooting.