▶Book Description
Lua is a small, powerful and extendable scripting/programming language that can be used for learning to program, and writing games and applications, or as an embedded scripting language. There are many popular commercial projects that allow you to modify or extend them through Lua scripting, and this book will get you ready for that. This book is the easiest way to learn Lua. It introduces you to the basics of Lua and helps you to understand the problems it solves. You will work with the basic language features, the libraries Lua provides, and powerful topics such as object-oriented programming. Every aspect of programming in Lua, variables, data types, functions, tables, arrays and objects, is covered in sufficient detail for you to get started. You will also find out about Lua's module system and how to interface with the operating system.
After reading this book, you will be ready to use Lua as a programming language to write code that can interface with the operating system, automate tasks, make playable games, and much more. This book is a solid starting point for those who want to learn Lua in order to move onto other technologies such as Love2D or Roblox.
A quick start guide is a focused, shorter title that provides a faster paced introduction to a technology. It is designed for people who don't need all the details at this point in their learning curve. This presentation has been streamlined to concentrate on the things you really need to know.
▶What You Will Learn
⦁ Understand the basics of programming the Lua language
⦁ Understand how to use tables, the data structure that makes Lua so powerful
⦁ Understand object-oriented programming in Lua using metatables
⦁ Understand standard LUA libraries for math, file io, and more
⦁ Manipulate string data using Lua
⦁ Understand how to debug Lua applications quickly and effciently
⦁ Understand how to embed Lua into applications with the Lua C API
▶Key Features
⦁ The easiest way to learn Lua coding
⦁ Use the Lua standard libraries and debug Lua code
⦁ Embed Lua as a scripting language using the Lua C API
▶Who This Book Is For
This book is for developers who want to get up and running with Lua. This book is ideal for programmers who want to learn to embed Lua in their own applications, and is also ideal for beginner programmers who have never coded before. Starting with an introduction to the Lua language, you will learn how to create variables and use loops and functions. You will learn advanced concepts, such as creating an object-oriented class system using only Lua tables. We look at the standard Lua libraries and learn how to debug Lua code. We will use Lua as an embedded scripting language and learn about the Lua C API in detail.
▶What this book covers
⦁ Chapter 1, Introduction to Lua, serves as an introduction to Lua by answering the question what is Lua? Next, the chapter walks the reader through downloading and installing the appropriate Lua binaries, as well as Visual Studio Code. Visual Studio Code is the code editor we will be using throughout this book to edit Lua files.
⦁ Chapter 2, Working with Lua, is a primer on the basics of the Lua language. For those who have not programmed before, this chapter teaches the basic concepts of programming, such as variables, loops, and functions. For the more experienced programmer reading the book, this chapter serves as an introduction to Lua's syntax.
⦁ Chapter 3, Tables and Objects, states that the most powerful features of Lua are its table and meta-table systems. Through these systems, the language it self can be extended. This chapter focuses on exploring what tables are, how they work, and how they can be used to extend the language to support concepts such as object-oriented programming.
⦁ Chapter 4, Lua Libraries, explains that Lua ships with a large and mature standard library. This chapter explores the functionality provided by the standard Lua libraries. The functionality exposed by the standard libraries allows us to do complicated math, work with files, and interface with the operating system.
⦁ Chapter 5, Debugging Lua, explains that Lua provides us with powerful debugging facilities that allow us to debug Lua code using Lua its-self. This chapter explores how to do this. In addition to exploring Lua's built-in debug facilities, optional tools that offer an intuitive and standard debugging interface are covered.
⦁ Chapter 6, Embedding Lua, discusses Lua's C API. This chapter covers all the API functions required to embed Lua into an existing application. Lua was designed to be an embeddable language, and therefore the C API is small, clean, and straightforward. By the end of the chapter, you will have mastered the Lua stack and will be able to work with Lua from C.
⦁ Chapter 7, Lua Bridge, explains that even though Lua's C API is simple, it's verbose. Doing basic tasks can take a lot of typing. Lua Bridge is a third-party Lua binding library that aims to make embedding Lua in C much easier and less verbose. All the Lua Bridge functionality needed for common tasks such as exposing functions, variables, or objects are covered in this chapter.
⦁ Chapter 8, Next Steps, explains that by now, you will have a solid grasp of the basics of programming, Lua, and the Lua C API. This chapter focuses on what you can do with all this new-found knowledge. Further books and learning resources are provided in this chapter. In addition to learning resources, some practical suggestions such as Lua-powered game engines and games that can be modified with Lua are made.