General Coding and Style Guidelines - RedDeadlyCreeper/ArmoredCombatExtended GitHub Wiki

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: image

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?

  1. We use tabs instead of spaces
  2. Consistency

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