Lua (not "LUA", which is incorrect although common) is a powerful, fast, lightweight and embeddable programming language. It is used by many frameworks, games and other applications. While it can be used by itself, it has been designed to be easy to embed in another application. It is implemented in ANSI C, a subset of the C programming language that is very portable, which means it can run on many systems and many devices where most other scripting languages would not be able to run. The purpose of this book is to teach Lua programming to anyone regardless of previous programming experience. The book can be used as an introduction to programming, for someone who has never programmed before, or as an introduction to Lua, for people who have programmed before but not in Lua. Since there are many development platforms and games that use Lua, this book can also be used to learn to use Lua and then to use it in that development platform.

This book aims to teach usage of the latest version of Lua. This means it will be attempted to regularly update it as new versions of Lua come out (Lua releases are infrequent enough that this should not be too difficult). Currently, the book is up-to-date for Lua 5.2, which is the previous version. If you are using Lua in an embedded environment that uses an older version of Lua in the 5.x branch (Lua 5.0 and Lua 5.1), the material should still be sufficiently relevant for you.

Contents

This book is divided into the following chapters and appendices:

Introduction 
This chapter introduces the Lua language and gives a brief overview of its purpose and history. It also introduces some programming concepts.
Expressions 
This chapters provides comprehensive coverage of expressions, operators and types.
Statements 
This chapter describes the statements available in Lua.
Functions 
This chapter explains the purpose and usage of functions and describes the syntax for function definitions.
Tables 
This chapter covers table constructors, metatables, iterators and sorting.
Standard libraries 
This chapter describes the functionality offered by the standard libraries.
Appendix: Software testing 
This appendix gives information about testing programs written in Lua.
Glossary 
This glossary contains accurate definitions of all significant terms used in the book and relevant to the subject.
Index 
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

  • This book is about Lua 5.2, the previous version of Lua. 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

Todo

  • Update the book to reflect changes in Lua 5.3. 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

  • 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.
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.