Having written tens of thousands of lines of Lua as well as several other langs, I have created guidelines for readable, maintainable, and even portable code.
I'm striving for a sanity that is very rare in the field of programming, that of simplicity. If you're using Lua on purpose, that should be appealing. Even if you're not using Lua, these ideas translate to Javascript and on some level any other language. In fact, following this paradigm makes your code more portable to C, to Rust, and to purely functional languages.
Even if it is not easy to adapt to this paradigm, by using it many headaches disappear. Good code is a narrow path. I can guide you to that path, but you must still walk it.
This article is inspired in part by this Gleam blog post, All you need is data and functions.