Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
The Lua programming language


1. The Lua programming language

2. Lua
LuaLua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description. "Lua" (pronounced LOO-ah) means "Moon" in Portuguese. As such, it is neither an acronym nor an abbreviation, but a noun. From the Lua web site is at https:///lua.org .

3. Wikipedia
The Wikipedia article at https://en.wikipedia.org/wiki/Lua_(programming_language) has a good background and short introduction to Lua.

4. Lua
Programming in Lua Lua - from Portuguese for "moon" - scripting language.

The programming/scripting language Lua is named for Portuguese name for "moon" as it was developed in Brazil in the 1990's.

The Lua web site is at https:///lua.org .

5. Author
Lua was created and still maintained by Roberto Ierusalimschy.

Roberto Ierusalimschy is the leading architect of the Lua programming language, driving its development since its inception in 1993. He is an Associate Professor of Computer Science at PUC-Rio (the Pontifical Catholic University of Rio de Janeiro), where he works with programming-language design and implementation. (from the Amazon biography author page for him)

6. Months
What is a full moon?


Why is it called a full moon when you can only see half of it?


The English word "moon" is related to the Greek word for "month". The lunar/moon cycle was used as the basis for a month. But Greek has other words for "moon". φεγγάρι = moon
μήνας = month

7. Lua use in applications
Lua is a scripting language written in ANSI C, and is popular in many game systems as well as in the following:

8. More lua use in applications
Here are some more applications that use Lua (that I have not actually used but may at some time).

9. Lua uses
My use of Lua includes the following.

10. Lua 2012 workshop
I have two talks at the 2012 Lua Workshop in Reston, Virginia, on November 29-30, 2012. The web site is https://www.lua.org/wshop12.html (as of 2019-09-01).

The video and PDF for those talks is on than web site.

11. LPEG
The LPEG (Lua Parsing Expression Grammar) adds a simple and yet powerful parsing capability to Lua.

I have used it for the following.

12. Hello world in Lua
The file type of a Lua program file is lua.

The following Linux command(s) create/edit a hello program in the your home directory using the nano text editor.
nano ~/hello.lua

Create the following program text in the editor that will output the text "Hello world"
print("Hello world")

To exit with save, remember to press Ctrl-X, then "y" (for yes) and Enter to exit.

The following Linux command(s) run the program.
lua ~/hello.lua

The output should be as follows.
Hello world


13. Program: decimal to binary
Let us look at a program to implement to algorithm for decimal to binary conversion.

The routine toBinary1 takes as input a value and returns the string representation in binary (base 2)

The first part of the program will use the hard-coded value of 156.

The second part will use a loop to output the decimal values and binary representations of the values from 0 to 16.

14. Lua code
Here is the Lua code.


15. Lua output
Here is the output of the Lua code.


16. End of page

17. Acronyms and/or initialisms for this page