table.insert(ignored, k)
end
if found_arg == 0 and k:find('^[A-Za-z]*_.*$') then
local p = mw.ustring.gsub(k, '^([A-Za-z]*)_.*$', '%1')
if col_names[p] then
-- Great!
found_arg = 1
end
end
if found_arg == 0 and k:find('^[A-Za-z]*_[A-Za-z]*_.*$') then
local p = mw.ustring.gsub(k, '^([A-Za-z]*_[A-Za-z]*)_.*$', '%1')
if col_names[p] then
-- Great!
found_arg = 1
end
end  
if found_arg == 0 and k:find('^match[%d]*_.*_.*$') then
local t1 = mw.ustring.gsub(k, '^match[%d]*_(.*)_(.*)$', '%1')
local t2 = mw.ustring.gsub(k, '^match[%d]*_(.*)_(.*)$', '%2')
found_arg = 1
if teams[t1] == nil or teams[t2] == nil then
if teams[t1] == nil then
table.insert(missing_teams, t1)
end
if teams[t2] == nil then
table.insert(missing_teams, t2)
end
end
end
if found_arg == 0 and k:find('^result_.*_.*$') then
local t1 = mw.ustring.gsub(k, '^result[%d]*_(.*)_(.*)$', '%1')
local t2 = mw.ustring.gsub(k, '^result[%d]*_(.*)_(.*)$', '%2')
found_arg = 1
if teams[t1] == nil or teams[t2] == nil then
if teams[t1] == nil then
table.insert(missing_teams, t1)
end
if teams[t2] == nil then
table.insert(missing_teams, t2)
end
end
end
if found_arg == 0 and (k:find('^name_') or k:find('^short_')) then
found_arg = 1
table.insert(orphaned_names, k)
end
if found_arg == 0 and (k:find('^note_') or k:find('^hth_')) then
found_arg = 1
if (k == 'hth_ABC' and v == 'H2H note') then
table.insert(warn, '')
elseif (k == 'note_ABC' and v == 'Team note') then
table.insert(warn, '')
elseif (k == 'note_res_AAA' and v == 'Result note') then
table.insert(warn, '')
else
table.insert(orphaned_notes, k)
end
end
if found_arg == 0 and (k:find('^col_') or k:find('^text_')) then
found_arg = 1
table.insert(orphaned_results, k)
end
end
if found_arg == 0 then
if pargs[k] and pargs[k] ~= '' then
if tonumber(k) then
k = k .. ' = ' .. v
end
table.insert(possibly_ignored, k)
else
if tonumber(k) then
k = k .. ' = ' .. v
end
table.insert(unknown, k)
end
end
end
end  
local badchar = '[^A-Za-z0-9_%(%)%- ]'
for k,v in ipairs(unknown) do
v = mw.ustring.gsub(v, badchar, '?')
if v == '' then v = ' ' end
table.insert(warn, '')
end
for k,v in ipairs(missing_teams) do
v = mw.ustring.gsub(v, badchar, '?')
if v == '' then v = ' ' end
table.insert(warn, '')
end
for k,v in ipairs(missing_results) do
v = mw.ustring.gsub(v, badchar, '?')
if v == '' then v = ' ' end
table.insert(warn, '')
end
for k,v in ipairs(orphaned_results) do
v = mw.ustring.gsub(v, badchar, '?')
if v == '' then v = ' ' end
table.insert(warn, '')
end
for k,v in ipairs(orphaned_names) do
v = mw.ustring.gsub(v, '[^A-Za-z0-9_ ]', '?')
if v == '' then v = ' ' end
table.insert(warn, '')
end
for k,v in ipairs(orphaned_notes) do
v = mw.ustring.gsub(v, badchar, '?')
if v == '' then v = ' ' end
table.insert(warn, '')
end
for k,v in ipairs(orphaned_match_notes) do
v = mw.ustring.gsub(v, badchar, '?')
if v == '' then v = ' ' end
table.insert(warn, '')
end
for k,v in ipairs(ignored) do
v = mw.ustring.gsub(v, badchar, '?')
if v == '' then v = ' ' end
table.insert(warn, '')
end
for k,v in ipairs(possibly_ignored) do
v = mw.ustring.gsub(v, badchar, '?')
if v == '' then v = ' ' end
table.insert(track, '')
end  
if possible_missing_winpoints > 1 then
table.insert(track, '')
end  
return warn,track
end  
return a