Module talk:Flags
Appearance
Code change
Hello I saw your module on it.wiki, and I would like to make some changes to the code:
- declare local all variables, they are more efficient and quick to access and you dont pollute global namespace
- Why do you use a for loop to check if a key is in the table like:
for flagParameter,commonsFile in pairs(master.twoLetter) do
if flagParameter == territory.args[1] then
commonsName = commonsFile
tempLink = commonsFile
end
end
is simpler and quicker try to assign and check for nil
commonsFile = master.twoLetter[territory.args[1]]
if commonsFile then --check for nil
commonsName = commonsFile
tempLink = commonsFile
end
3. Why check for if territory.args[2] ~= "{{{2}}}" then
? AFAIK a paremeter call will be resolved before call the module and substituded by its value.
I will upload my changes to the sandbox for test.--Moroboshi (talk) 11:14, 22 July 2013 (UTC)