Five Getting Started with Lua scripting language

Source: Internet
Author: User

---restore content starts---

After writing this LUA scripting language primer, I will try to use LUA scripting language to write esp8266, and now quite impatient, because friends use esp8266 originally said that he helped write a program, but with the single-chip computer is not the same as their own, there is no way to test, with at the command will appear inconvenient, Also according to the single-chip computer to change the program, and I used to feel at the command to send information that block, trouble,,,, oneself know to use the script to operate 8266 more flexible and stable than at command, really want to quickly learn to use LUA script to operate 8266, so that can be very convenient to help friends ... It was promised that,,,,,,, would have reneged ... Heart.....

If someone's WiFi and ESP8266 combination is good,,, someone's WiFi module configuration once, do not have to take care of the,,, send the message does not need to send an instruction, directly to the serial port in the line,,,,, the client connection more, will turn off the other, so effective to prevent the removal of residual connections;

ESP8266 return information will be added in the following line, so that only to determine the line can be determined to be a complete message, 8266 Price is too tempting, more than a person's WiFi module is much cheaper, can use

Lua language, support for Iic,spi,iwire (single bus), ADC, development flexibility and strong functionality

The functions in Lua actually ..... And the same as the variable to operate---now load the image of their own computer browser load does not appear on the,,, load

It can be said that the function name in Lua is just a variable to implement a function---function Ben nameless,,,, give him a name is just convenient to call,,,,

Look at a familiar example, and this should be well understood

Now write function B () to the inside of a

This function is called----closed function,,, translated .... Someone else translates.

Now look at how to invoke, LUA provides this functionality, call it, and need to change it, and I feel it changing the calling method is to enhance its functionality .... I just feel it.

A classic example

Then look

Look at a function sort

Because the function is a variable, it takes him as an argument to another function .... noun-------higher order function----Suddenly think of a high number.

How do I write an iterator,,,,,,,, a program that iterates through an array

There's nothing to be lazy about, so write

If you're using generics for,---this little iterator looks like it works.

The rest of the knowledge is written in practice,,,,,, Lua is difficult,,, look at the back,,, days!!!!!! Scary, like I didn't learn C, I went to the library to borrow a book about the circuit

There is a later in the C language of the program,, at that time in the thinking, rely on, what can not understand, so difficult, will certainly not be used in the future ....

Five Getting Started with Lua scripting language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.