An unscheduled dive into the world of Nmap Scripting last night has caused me to need Emacs to be configured to handle Lua code. As usual, packages are there to make life better:

(use-package lua-mode
  :ensure t
  :pin melpa-stable
  (add-hook 'lua-mode-hook
            (lambda ()
              (setq lua-indent-level 2
                    lua-documentation-url ""
                    lua-default-application "lua5.3"))))

The default indentation in Lua mode is 3 spaces, which seems insane to me, and needs to be 2 spaces to match every bit of Lua I've ever seen. The default documentation is for version 5.1, and the default interpreter on my system is version 5.2, but Nmap embeds version 5.3. The documentation URL allows me to use C-c C-f on a function or keyword to open its documentation in the browser. Finally, Nmap uses a non-standard file extension, .nse for Nmap Scripting Engine, which we need to make Emacs aware of.

The results of last night's Nmap programming can be found here, if you're interested.