Lua is a dynamically typed language that is perfect for quick scripting. It is very light, memory-safe, and offers useful functions for collaborative multitasking, pattern matching, data modelling, and string handling. Nmap uses Lua to power its scripting engine called NSE. In this chapter, I tried to provide the fundamentals of Lua for those who are not familiar with the language. I covered topics such as string manipulation, flow control structures, data types, and even special quirks in the language.
I firmly believe that, to truly master NSE, one must be able to debug and create NSE scripts. Those who do will have an invaluable tool at their disposal. In the next chapter, we will go deep into the core of NSE to learn its libraries, functions, and secrets. As in any other programming language, practice makes a master. After each chapter, try to apply the concepts and write at least one script. If you do that, then, by the end of this book, you will have mastered NSE.