Lua "code style" tool

I was recently introduced to a tool called “code style” in my java class that analyzes the style of your code based on a standard and tells you how to fix any inconsistencies. For example, if you don’t put spaces before and after an operator, it will tell you to add spaces.

My question is whether there exists a check style tool for Lua? I can’t find one with a quick search.

2 Likes

Please move this post to a more appropriate category/subcategory.

1 Like

I think your best bet would be manually styling it neatly unless you switched to a VS code + Rojo workflow

Here’s a style guide from Roblox themselves
https://roblox.github.io/lua-style-guide/

3 Likes

This is definitely related to scripting, and definitely fits into “everything” - code review is for reviewing specific parts of code, and shouldn’t be pointed to the instant someone says anything about formatting.

This is not at all the same thing. He’s not asking for a code review, he’s asking for a scripting utility.

In the software dev world, this is known as a “linter.” It helps enforce style and best practices. Just about every popular language has a linter available.

For Lua, the best we have (that I know of) is Luacheck. You will have to install LuaRocks first to get it. LuaRocks is a package manager for Lua.

Then you can use VS Code and Rojo as @Zooleos said.

Here’s a screenshot example, where Luacheck has informed me that my “hello” variable is not used anywhere else in my code:
hello

8 Likes

I should have mentioned that this was originally in #development-support:code-review.

5 Likes