Do the square brackets matter in code?

Joined
Apr 11, 2015
Messages
438
Comparing mod codes, some use square brackets, while others omit them. Are both code forms valid and will work in the game?

See below for a couple of examples taken from mod codes.

Code:
UPDATE Leader_MajorCivApproachBiases SET Bias = 10 WHERE MajorCivApproachType = 'MAJOR_CIV_APPROACH_WAR';
vs
UPDATE [Leader_MajorCivApproachBiases] SET [Bias] = [Bias] + 2 WHERE MajorCivApproachType = 'MAJOR_CIV_APPROACH_WAR';

and

UPDATE Leaders SET VictoryCompetitiveness = 10;
vs
UPDATE [leaders] SET [VictoryCompetitiveness] = [VictoryCompetitiveness] + 4;
 
in sql they are not necessary

A good habit to get into is to follow the capitalization format used by Firaxis for table names and column names. So
Code:
UPDATE Leaders SET VictoryCompetitiveness = 10;
instead of
Code:
UPDATE leaders SET VictoryCompetitiveness = 10;
99% of the time it does not matter, but if you use xml for example, then "<Row>" is not equivalent to "<row>". And in lua code, capitalization nearly always matters.
 
Thanks for the info. This code is from the Aggressive and Expansive AI mod. I presume the non-capitalized L's in "leaders" is okay in this case?
Code:
UPDATE [leaders] SET [WonderCompetitiveness] = [WonderCompetitiveness] + 2;
UPDATE [leaders] SET [MinorCivCompetitiveness] = [MinorCivCompetitiveness] + 2;
UPDATE [leaders] SET [VictoryCompetitiveness] = [VictoryCompetitiveness] + 4;
UPDATE [leaders] SET [Boldness] = [Boldness] + 2;
 
Top Bottom