Module:Lang/data/iana languages/make: Difference between revisions

Content deleted Content added
m find function may be faster in if-statements
basic gmatch is safe here
Line 45:
end
 
for line in mw.ustringstring.gmatch (record, '([^\n]+)\n') do -- get a \n terminated line of text (without the \n)
if mw.ustring.find (line, 'Subtag: [%a%d]+') then -- if this line is the subtag line
code = mw.ustring.match (line, 'Subtag: ([%a%d]+)'); -- extract and save to subtag's code
Line 104:
end
 
for line in mw.ustringstring.gmatch (record, '([^\n]+)\n') do -- get a \n terminated line of text (without the \n)
if mw.ustring.find (line, 'Subtag: [%a%d]+') then -- if this line is the subtag line
code = mw.ustring.match (line, 'Subtag: ([%a%d]+)'); -- extract and save to subtag's code
Line 148:
file_date = content:match ('(File%-Date: %d%d%d%d%-%d%d%-%d%d)'); -- get the file date line from this version of the source file
 
for record in mw.ustringstring.gmatch (content, '%%%%([^%%]+)') do -- get a %% delimited 'record' from the file; leave off the delimiters
if mw.ustring.find (record, 'Type: language') then -- if a language record
code, descriptions = get_lang_script_region_parts (record); -- get the code and description(s)