Latest web development tutorials

Lua Tutorial

lua

Lua is a lightweight compact scripting language, using the standard C language and open source code form, which is designed for embedded applications, providing flexible expansion and customization features for the application.

Lua Brazil Pontifical Catholic University of Rio de Janeiro (Pontifical Catholic University of Rio de Janeiro) in a research team from Roberto Ierusalimschy, Waldemar Celes and Luiz Henrique de Figueiredo formed and developed in 1993.


Designed

It is designed for embedded applications, providing flexible expansion and customization features for the application.


Lua feature

  • Lightweight: It is written in standard C language source code is open and, after compiling only a hundred K, can be easily embedded in other program.
  • Scalable: Lua provides a very easy-to-use interface and the expansion mechanism: Provided by the host language (usually C or C ++) these functions, Lua can use them just like built-in functions are already the same.
  • Other features:
    • Support process-oriented (procedure-oriented) programming and functional programming (functional programming);
    • Automatic memory management; only provides a common type of table (table), it can be achieved using arrays, hash tables, a collection of objects;
    • Built-in pattern matching language; closure (closure); function can also be seen as a value; providing multi-threaded (cooperative process, not the operating system supports threads) support;
    • It can easily support a number of key mechanisms of object-oriented programming required by closures and table, such as data abstraction, virtual functions, inheritance and overloading the like.

Lua scenarios

  • game development
  • Stand-alone script
  • Web application scripting
  • Extensions and plug-ins such as databases: MySQL Proxy and MySQL WorkBench
  • Security systems, such as intrusion detection systems

First Lua program

Next we use Lua to output "Hello World!"

Examples (Lua 5.3)

print ( "Hello World!")

Running instance »

After the run, it will be displayed on the screen Hello, world !.