100% developed

Lua Programming

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Lua (/ˈluːə/ LOO-ə; from Portuguese: lua [ˈlu.(w)ɐ] meaning moon) is a lightweight, high-level, multi-paradigm programming language created in 1993 by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes.

Lua is implemented in C and has simple API which helps it interface easily with other languages.

This programming language is also related to (other than C/C++): Python, Java, Javascript, as well as a few concepts of Perl and etc.


Lua is mainly used for embedded systems and for game development. Some games that are scripted in Lua include: World of Warcraft, Roblox games, Angry Birds (video game) and etc.

Some other sources that use Lua include Nmap and Adobe Lightroom.

Lua's latest version is version 5.4.3 and was released @2020-1.

Some text editors that use Lua include: SciTE, Notepad++ with Autocompletion Plugin, Visual Studio with BabeLua Plugin, ZeroBrane Studio and Atom Editor with the Love-IDE collection of packages.

At first in its release it was used as home programming language then later appeared publicly. The most famous Lua book is by Roberto Ierusalimschy, the creator of Lua and its called "Programming in Lua fourth edition"


According to 2021 statistics so far, Lua is used 0.47 percent out of all programming languages!

Contents[edit | edit source]

This book is divided into the following chapters and appendices:

Introduction 100% developed
This chapter introduces the Lua language and gives a brief overview of its purpose and history. It also introduces some programming concepts.
Expressions 100% developed
This chapters provides comprehensive coverage of expressions, operators and types.
Statements 100% developed
This chapter describes the statements available in Lua.
Functions 100% developed
This chapter explains the purpose and usage of functions and describes the syntax for function definitions.
Tables 100% developed
This chapter covers table constructors, metatables, iterators and sorting.
Standard libraries 100% developed
This chapter describes the functionality offered by the standard libraries.
Appendix: Software testing 100% developed
This appendix gives information about testing programs written in Lua.
Glossary 100% developed
This glossary contains accurate definitions of all significant terms used in the book and relevant to the subject.
Index 100% developed
This index contains a list of all the topics and functions covered in the book and references to the locations in the book where these topics and functions are described.


Notes[edit | edit source]

  • This book is about Lua 5.2. Information about past versions of Lua must be explicitly marked as not being relevant to the current version, but should be included as long as it is part of the current main branch (in this case, Lua 5.x). If the information is part of history material, then it may be included regardless of the version.
  • See also: Scribunto: An Introduction for using Lua in w:MediaWiki.

To do[edit | edit source]

  • Update the book to reflect changes in Lua 5.3 and 5.4. This was already done in part regarding integers and bitwise operators.
  • Write a chapter about the different programming paradigms (object-oriented, functional) that Lua enables.

Writing and style[edit | edit source]

  • All headers and titles should use sentence case.
  • The book should be self‐contained, but it's fine to add links to other books, Wikipedia or other Wikimedia projects, as long as these links are only used for supplementary material.
  • Variable names should be enclosed in <var>...</var> tags.
  • When terms are defined in nearby text, they should be enclosed in <dfn>...</dfn> tags. The first full definition of a term that is the subject of a chapter should be marked with the {{subject definition}} template in that chapter.
  • Keyboard keys that the user is instructed to press should be enclosed in <kbd>...</kbd> tags.
  • Emphasis should be marked using <em>...</em> and <strong>...</strong> tags or using wiki markup for italics or bold.
  • Code keywords or in‐line code should be enclosed in <code>...</code> tags.
  • Code examples should use syntax highlighting with the <source>...</source> tag. Code should be indented and easy to read, and variable names should accurately represent their value. Tabulations should be used to indent code and underscores should be used to separate words in variable names.
  • Code output should be enclosed in <samp>...</samp> tags.