I found a script at https://www.oschina.net/code/snippet_563463_19381 that uses Perl regex to auto-indent Lua files. The approach seemed good - a single file can do simple automatic indentation. But after searching GitHub for a long time, I couldn’t find any related Lua standalone project code.
Side note about LuaRocks: to use scripts installed by LuaRocks, you need to have LuaRocks installed on the machine. So even if you resolve dependencies when packaging by calling LuaRocks, it won’t work unless you add LuaRocks to the dependencies. This is very unfriendly for someone like me with a standalone obsession.
I rewrote the Perl version of auto-indent into a Lua version. The regex uses ngx.re from OpenResty, and it needs to be started using the resty command line or within openresty (two startup methods).