Module talk:Flags
Appearance
Code change
Hello I saw your module on it.wiki, and I woul like to make some changes to the code:
- declare local all variable, 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
I will upload my changes to the sandbox for test.--Moroboshi (talk) 11:14, 22 July 2013 (UTC)