Автор: Harry Yoon
Издательство: Coding Books Press
Год: November 9, 2022
Страниц: 196
Язык: английский
Формат: pdf, epub, mobi
Размер: 10.1 MB
Learn Lua Programming in a Weekend!
This book is a mini language reference on the Lua programming language. Lua is one of the "smallest" and simplest programming languages, and it is widely used as a scripting language in many applications, including various game engines such as Roblox. Lua is a "beginner-friendly" programming language. We go through all important features of Lua, as a standalone coding language in this book.
Although the book is written as a reference, you can read it more or less from beginning to end and you should be able to get the overall picture of the Lua language if you are familiar with some basic syntax of Lua. The book also includes all essential builtin functions and the standard library functions.
Few people who program actually go through any kind of formal learning process, for any programming languages. They just "pick up" pieces of information, here and there, and most of the time they learn by trials and errors, "on the job", so to speak. This is especially true for languages like Lua. Many people pick up Lua while using beginner-friendly tools like Roblox, bit by bit. To many people who have experience with other programming languages, on the other hand, Lua appears to be an easy language (as in "not a serious language"), which does not require learning. Clearly, these are misconceptions. Learning this way has, obviously, limitations. That’s like building a house on the sand. Your progress will be slow in the long run when you are on the shaky ground. (And, Lua is no different from other "more professional languages".) This book will help you build a solid foundation on your future Lua programming journey. It goes through all the essential features of the language, not just the syntax, but all the crucial concepts.
Lua is a rather interesting language. It is one of the simplest general purpose programming languages, and it is easy to learn and easy to use. Lua is dynamically typed, and it supports automatic memory management (e.g., garbage collection). Lua is primarily used as an embedded language, often to interface with the host programs written in C. Lua is also widely used as a standalone scripting language, for the purposes of configuring, scripting, and rapid prototyping, among other things.
Lua has many similarities with other dynamic languages like Python and jаvascript, and yet it is even simpler. It is an ideal language for beginning programmers to start learning programming with. If you want to enable scripting in your own programs, e.g., written in C or C++, or other similar languages, it is also the best language for your end users, who may not necessarily be experienced programmers. For example, many gaming engines provide scripting via Lua. One of the most popular such gaming engines is Roblox. Many people learn Lua for Roblox programming. More professional software like Redis and Nmap also use Lua for scripting. In fact, the applications that use Lua for scripting are too numerous to list here. There are hundreds, if not thousands, of them.
This book is written for a broad audience with diverse background. We cover topics ranging from the absolute basics to rather advanced subjects. However, it is not for complete beginners. It is written as a reference style. Some basic programming knowledge is required. On the flip side, although it is written as a reference, you can read this book more or less from beginning to end to get the overall picture of the Lua programming language. This book is not an authoritative language reference. For that, we recommend the readers refer to the official language specification.
The book covers:
Lua standalone interpreter. How to effectively use the Lua REPL.
Lua program execution. How to run the lua command in various ways.
Types, literals, variables. How to assign values to local variables and reference them.
Expressions. For example, how to do simple arithmetic and comparison operations.
Functions. How to define a named and unnamed functions, and how to call these functions.
Statements, such as the if conditional and the for, while, and repeat iteration statements.
Tables. And, various uses of tables as a map and an array, etc.
Metatables. How to customize the behavior of tables using metamethods.
Basic object-oriented programming (OOP) in Lua. Factory methods and classes.
Iterators. How to customize the iteration behavior of tables.
Concurrency. Various coroutine methods for thread lifetime management.
Lua standard libraries: math, string, table, os, io, file, and coroutine.
Скачать Lua Mini Reference 2022: A Quick Guide to the Lua Scripting Language for Busy Coders