if 2 == code:len then
table.insert (iso_639_1_table, "[\"" .. code .. "\"] = {" .. descriptions .. "}"); -- make table entries
end
end
elseif not code then
table.insert (lang_table, "[\"error\"] = {" .. record .. "}"); -- code should never be nil, but inserting an error entry in the final output can be helpful
end
-- here we collect suppress stript tags and their associated language codes;
-- prettigying the data in this table must wait until all language codes have been read
if suppress then -- if this code has a suppressed script
local suppressed_code = table.concat ({'\"', code, '\"'}); -- wrap the code in quotes  
if suppress_table[suppress] then -- if there is an entry for this script
table.insert (suppress_table[suppress], suppressed_code); -- insert the new code
else
suppress_table[suppress] = {}; -- add new script and empty table
table.insert (suppress_table[suppress], suppressed_code); -- insert the new code
end
end  
elseif record_type == 'script' then -- if a script record
code, descriptions = get_lang_script_region_parts (record); -- get the code and description(s)  
if code and ('skip' ~= code) then
table.insert (script_table, "[\"" .. code .. "\"] = {" .. descriptions .. "}"); -- make table entries
elseif not code then
table.insert (script_table, "[\"error\"] = {" .. record .. "}"); -- code should never be nil, but ...
end  
elseif record_type == 'region' then -- if a region record
code, descriptions = get_lang_script_region_parts (record); -- get the code and description(s)  
if code and ('skip' ~= code) then
table.insert (region_table, "[\"" .. code .. "\"] = {" .. descriptions .. "}"); -- make table entries
elseif not code then
table.insert (region_table, "[\"error\"] = {" .. record .. "}"); -- code should never be nil, but ...
end  
elseif record_type == 'variant' then -- if a variant record
code, prefixes, descriptions = get_variant_parts (record); -- get the code, prefix(es), and description(s)  
if code and ('skip' ~= code) then
table.insert (variant_table,
table.concat ({
"[\"",
code,
"\"] = {
&#9;&#9;[\"descriptions\"] = {",
descriptions,
"},
&#9;&#9;[\"prefixes\"] = {",
prefixes,
"},
&#9;&#9;}"
})
);
elseif not code then
table.insert (variant_table, "[\"error\"] = {" .. record .. "}"); -- code should never be nil, but ...
end
end
end
-- now prettify the supressed script table
local pretty_suppressed = {};  
for script, code_tbl in pairs (suppress_table) do
local LIMIT = 11; -- max number of subtags on a line before a line break
local fragment_tbl = {}; -- groups of LIMIT number of subtags collected here  
for i=1, #code_tbl, LIMIT do
local stop = ((i+LIMIT-1) > #code_tbl) and #code_tbl or i+LIMIT-1; -- calculate a table.concat stop position
table.insert (fragment_tbl, table.concat (code_tbl, ', ', i, stop)); -- get the fragment and save it
end  
table.insert (pretty_suppressed, -- and make all pretty
table.concat ({'[\"', script, '\"] = {', table.concat (fragment_tbl, ',\n\t\t\t\t'), '}'})
);
end
table.sort (pretty_suppressed);  
-- make final output pretty
return '
<pre>------------------------------< I A N A L A N G U A G E S >--------------------------------------------------
--' ..
file_date .. "
local active = {
&#9;" .. table.concat (lang_table, ',
&#9;') .. "
&#9;}  
" ..
"local deprecated = {
&#9;" .. table.concat (lang_dep_table, ',
&#9;') .. "
&#9;}  
" ..
"return {
&#9;active = active,
&#9;deprecated = deprecated,
&#9;}  
" ..
'------------------------------< I A N A S C R I P T S >------------------------------------------------------
--' ..
file_date .. "
return {
&#9;" .. table.concat (script_table, ',
&#9;') .. "
&#9;}  
" ..
'------------------------------< I A N A R E G I O N S >------------------------------------------------------
--' ..
file_date .. "
return {
&#9;" .. table.concat (region_table, ',
&#9;') .. "
&#9;}  
" ..
'------------------------------< I A N A V A R I A N T S >----------------------------------------------------
--' ..
file_date .. "
return {
&#9;" .. table.concat (variant_table, ',
&#9;') .. "
&#9;}  
" ..
'------------------------------< I A N A S U P P R E S S E D S C R I P T S >--------------------------------
--' ..
file_date .. "
return {
&#9;" .. table.concat (pretty_suppressed, ',
&#9;') .. "
&#9;}  
" ..
'------------------------------< I S O 6 3 9 - 1 >------------------------------------------------------------
--' ..
file_date .. "
return {
&#9;" .. table.concat (iso_639_1_table, ',
&#9;') .. "
&#9;}  
" .. "</pre>";
end  
----------------------------< E X P O R T E D F U N C T I O N >--------------------------------------------  
return {
iana_extract = iana_extract,
}