General Coding And Style Guidelines

🛠️ Modifying & ContributingUpdated 2 days ago3 views

ACE GLua Style Guidelines
Some general information regarding how to make the linter happy, and how to not make your code ugly.

As a general rule, try to stay close to the style of the file you're currently editing. If you're making a new file, check the CFC Style Guidelines , ESPECIALLY the "General" section.

If the above guidelines are too much to follow, at least keep the following sections in mind.

No "Garry operators"/C-style operators, use standard Lua!
Bad:

if Var1 && (Var2 || Var3) then
print("Done") // finished
end

Good:

if Var1 and (Var2 or Var3) then
print("Done") -- finished
end

Magic Numbers
ACE is plagued with these, we don't need more of them. Unit conversions and whatnot should be specifically defined before being used.

Bad:

local Penetration = Velocity * 39.3701 * 2.5

Worse:

Good:

local MetersToInches = 39.3701
local OPFactor = 2.5 -- Make shells more OP by this amount
local Penetration = Velocity * MetersToInches * OPFactor

What is linter looking for?

- We use tabs instead of spaces

- Consistency

Find others here: https://github.com/MartyX5555/ACE-Dev/blob/master/.glualint.json

Was this article helpful?

See More

Discussion(0)

No comments yet. Be the first to ask a question!

Have a question? Sign in to join the discussion.