Lua Is a lightweight and compact scripting language , Use standard C Language and open in the form of source code , It is designed to be embedded in the application , So as to provide flexible extension and customization functions for applications .
Lua It's the Catholic University of Rio de Janeiro, Brazil （Pontifical Catholic University of Rio de Janeiro） A research group in 1993 Developed in , The members of the group are ：Roberto Ierusalimschy、Waldemar Celes and Luiz Henrique de Figueiredo.
It is designed to be embedded in the application , So as to provide flexible extension and customization functions for applications .
- Lightweight : It uses standard C Language and open in the form of source code , After compilation, only more than 100 K, It can be easily embedded in other programs .
- Scalable : Lua It provides a very easy-to-use extension interface and mechanism ： By the host language ( Usually C Or C++) Provide these functions ,Lua You can use them , It's like a built-in function .
- Other features :
- Support process oriented (procedure-oriented) Programming and functional programming (functional programming);
- Automatic memory management ; Only one common type of table is provided （table）, It can be used to realize array , Hash table , aggregate , Object ;
- Language built-in pattern matching ; closure (closure); Function can also be regarded as a value ; Provides multithreading （ Collaborative processes , Not a thread supported by the operating system ） support ;
- Through closures and table It can easily support some key mechanisms required by object-oriented programming , Such as data abstraction , Virtual functions , Inheritance and overloading .
Lua Application scenario
- Game development
- Independent application script
- Web Application script
- Extensions and database plug-ins such as ：MySQL Proxy and MySQL WorkBench
- safety system , Such as intrusion detection system
first Lua Program
Next we use Lua To output "Hello World!"
example (Lua 5.3)
Run instance »
After operation , Will be displayed on the screen Hello, world!.