Lua Tutorial

lua-users home
wiki

Introduction

About the tutorial

This tutorial is aimed at all newcomers to the language Lua. We start off with where to find relevant introductory material and then progress to using the language with tutorials in the TutorialDirectory. The style is directed at newcomers to scripting languages, as well as newcomers to Lua. Common uses of Lua are:

The tutorial tries to appeal to users of Lua on several levels:

The style is simple, with lots of examples. It is hoped that from this straightforward approach that the information presented can be assimilated by all of the above users at their own pace. Since Lua is very versatile you may have to search a little to find what you want.

Note to programmers wanting to embed Lua: Please note that this tutorial is aimed at usage of the scripting language, rather than the C API for embedding. A tutorial for usage of the C API may be added at a later date.

This site you are reading is a wiki. It allows contributors to edit page content at will. It is built up from many different sources by a CastOfCharacters and anonymous sources, so you may notice some inconsistency in style. The site has a vague content structure starting at LuaDirectory. You can find help on how this wiki works in WikiHelp and more information on wikis in WikiFurtherReading.

About Lua

Lua is a powerful, lightweight scripting language. A more complete description is available at the official website [1]. If you haven't encountered Lua before, and you don't know anything about it, you may want to spend some time reading some of the articles on LuaOrgGuide. This will provide some background and insight into the nature of Lua. It is a useful source of inspiration, and may help you to use the language more fully.

Let's start

Running Lua

Please note that this tutorial assumes you are using Lua version 5.1. A lot of the content will work with other versions, but obviously not all. It is assumed that you will try the examples and experiment with Lua whilst learning it. You will therefore need an executable version of Lua.

There is a page for contributed LuaBinaries for various platforms. Should you prefer to compile Lua yourself, the source is available from the official site [2] and there are some notes and build packages on BuildingLua.

LuaLiveDemo: If you are curious and would like to quickly try Lua without having to download anything you could try [Lua Demo] directly in your browser.

The tutorials

The tutorials are listed in the TutorialDirectory. It is suggested that you read them in the order from top to bottom. The topics increase in complexity as you progress down the page.

Notes on tutorial authoring style

The following are some notes about the style used to author the tutorial. If you are thinking of contributing to the tutorial then please read the following:

Connect with the community

Better to start this journey with some help from the community, visit http://www.lua.org/community.html#meeting to find ways to connect with us.

May the force be with you!

Thanks

-- The primary author of this tutorial is NickTrout should you have any questions or feedback.

RecentChanges · preferences
edit · history
Last edited May 19, 2020 1:38 am GMT (diff)