Chapter 2 - Exploring Lua Basics
Errata
Table of Contents
Exploring Lua Basics - 9
- Using the Lua Interpreter 9
- Running Commands - 10
- Understanding Error Messages - 10
- Using History to Make Changes - 11
- Quitting the Interpreter - 11
- Microsoft Windows - 11
- Mac OS X - 11
- Working with Numbers - 12
- Basic Arithmetic Operations - 12
- Scientific Notation - 13
- Hexadecimal Notation - 14
- Understanding Floating Point - 14
- Understanding Values and Variables - 15
- Exploring Values and Their Types - 15
- Primitive Types - 15
- Using the type() Function - 16
- Using Variables - 16
- Valid Variable Names - 17
- Assigning Variables - 17
- Assigning Multiple Variables - 18
- Comparing Values - 18
- Working with Strings - 19
- Comparing Strings - 19
- Concatenating Multiple Strings - 20
- Converting Numbers to Strings - 20
- Converting Strings to Numbers - 21
- Quoting Strings - 21
- Single Quote (') - 21
- Double Quote (") - 22
- Bracket Quote ([[ ]]) - 22
- Escaping Special Characters - 23
- Getting a String’s Length - 24
- Boolean Values and Operators - 25
- Using the and Operator - 25
- Using the or Operator - 26
- Negation Using the not Operator - 26
- Understanding the nil Value - 27
- Exploring Scope - 27
- Summary - 29