Touch Lua Wiki

Don't know a thing about Lua and need to know how to start? Or are you ready learn how to print the contents of a file and make variables persistent? These Tutorials will help you fix it.

The Basics of Lua

Starting to program in Lua? Visit these tutorials to learn how to program.

  1. Hello Lua (Learn the basics of Lua.)
  2. Variables and Printing (The six types of variables and how to print a variable to the screen.)
  3. Making your First Function (How to make your own custom function.)
  4. Loops and Statements (Learn how to make for and while loops and also use the statements to make certain things happen only if a condition turns out true.)
  5. The Difference between Local and Global (Learn the cause of that variable turning into nil when the script errors at that line.)
  6. Putting Stuff on Tables (Learn more about Tables and multidimensional Tables.)
  7. Tips and Tricks (Some other tips and tricks used when making scripts.)

Running Scripts From Other Scripts

Your script is getting large and the editor is getting more laggy because of the large script. To combat this you will need to split up the script into multiple parts.

  1. How to Use Modules (Learn how to use the require function.)
  2. dofile (Information on the dofile function.)
  3. The Load Function (The load function can be used to load a function from a string.)

Introduction of Concepts

Here is a list of tutorials that introduce you to things such as reading from and writing to files, modular scripts, coroutines, object oriented programming, and more.

Introduction to Disk IO

Object Oriented Programming

  • How to Create a Class (Learn how to create classes using the setmetatable function.)
  • How to Make a Vector3 more like a number (There are more metatable functions than __index. Learn how to use the extra functions to make a Vector3 class that can be used like a number can.)

Dealing with Coroutines

  • Using Coroutines (Learn about Coroutines.)
  • Building a Custom Ilterator (Make a custom ilterator function that goes through elements of multiple tables.)
  • Making Async Functions (Build a module that allows you to make asynchronous functions.)