The country() function returns true if the country code for the query source IP address matches the country code passed to the function.
The countryCode() function doesn't take any arguments and just returns the country code of the query source IP address.
For this example, we're checking if the country for the query source IP address is "US" and expecting a true/false response, so country() is the correct function to use.
Alternatively, this would be something like "if countryCode() == 'US' then return...".
LUA records can also contain more complex code, for example::
- www IN LUA A ";if countryCode('US') then return {'192.0.2.1','192.0.2.2','198.51.100.1'} else return '192.0.2.2' end"
+ www IN LUA A ";if country('US') then return {'192.0.2.1','192.0.2.2','198.51.100.1'} else return '192.0.2.2' end"
As you can see you can return both single string value or array of strings.