Lua is a lightweight, efficient scripting language that integrates features into other programs written in C/C++.
Lua is used in Nmap because it is lightweight, efficient, and easily embeddable.
The Lua syntax is similar to Python.
To write a Nmap script in Lua, we create an NSE(Nmap Script Engine) file and create functions to discover information about a target.
To run a Nmap script created in Lua, we must create an NSE(Nmap Script Engine) file and save it in the Nmap scripts directory.