Use this to update Module:scripts/by name and Module:scripts/code to canonical name.

return {
	["adlam"] = "Adlm",
	["afaka"] = "Afak",
	["ahom"] = "Ahom",
	["anatóliai hieroglifák"] = "Hluw",
	["arab"] = "Arab",
	["avestan"] = "Avst",
	["balinese"] = "Bali",
	["bamum"] = "Bamu",
	["bassa"] = "Bass",
	["batak"] = "Batk",
	["baybayin"] = "Tglg",
	["bengáli"] = "Beng",
	["bhaiksuki"] = "Bhks",
	["book pahlavi"] = "Phlv",
	["brahmi"] = "Brah",
	["braille"] = "Brai",
	["buginese"] = "Bugi",
	["buhid"] = "Buhd",
	["burmai"] = "Mymr",
	["carian"] = "Cari",
	["chakma"] = "Cakm",
	["cham"] = "Cham",
	["cherokee"] = "Cher",
	["chorasmian"] = "Chrs",
	["ciprusi"] = "Cprt",
	["cirill"] = "Cyrl",
	["deseret"] = "Dsrt",
	["dogra"] = "Dogr",
	["duployan"] = "Dupl",
	["démotikus"] = "Egyd",
	["dévanágari"] = "Deva",
	["egyiptomi hieroglif"] = "Egyp",
	["egyszerűsített kínai"] = "Hans",
	["elbasan"] = "Elba",
	["etióp"] = "Ethi",
	["flag semaphore"] = "Semap",
	["fraktur"] = "Latf",
	["főníciai"] = "Phnx",
	["glagolita"] = "Glag",
	["gothic"] = "Goth",
	["grantha"] = "Gran",
	["grúz"] = "Geor",
	["gudzsaráti"] = "Gujr",
	["gunjala gondi"] = "Gong",
	["gurmukhi"] = "Guru",
	["görög"] = "Grek",
	["hagyományos kínai"] = "Hant",
	["hangul"] = "Hang",
	["hanifi rohingya"] = "Rohg",
	["hanunoo"] = "Hano",
	["hatran"] = "Hatr",
	["hiragana"] = "Hira",
	["hmong"] = "Hmng",
	["héber"] = "Hebr",
	["iberian"] = "Ibrn",
	["image-rendered"] = "Imag",
	["imperial aramaic"] = "Armi",
	["indus"] = "Inds",
	["inscriptional pahlavi"] = "Phli",
	["inscriptional parthian"] = "Prti",
	["international phonetic alphabet"] = "IPAchar",
	["japán"] = "Jpan",
	["jurchen"] = "Jurc",
	["jávai"] = "Java",
	["kaithi"] = "Kthi",
	["kanadai szótagírás"] = "Cans",
	["kannada"] = "Knda",
	["katakana"] = "Kana",
	["kaukázusi albán"] = "Aghb",
	["kayah li"] = "Kali",
	["kharoshthi"] = "Khar",
	["khitan large"] = "Kitl",
	["khitan small"] = "Kits",
	["khmer"] = "Khmr",
	["khojki"] = "Khoj",
	["khudawadi"] = "Sind",
	["khutsuri"] = "Geok",
	["kopt"] = "Copt",
	["koreai"] = "Kore",
	["kínai"] = "Hani",
	["lao"] = "Laoo",
	["latin"] = "Latn",
	["leke"] = "Leke",
	["lepcha"] = "Lepc",
	["limbu"] = "Limb",
	["lineáris A"] = "Lina",
	["lineáris B"] = "Linb",
	["lisu"] = "Lisu",
	["lycian"] = "Lyci",
	["lüd"] = "Lydi",
	["mahajani"] = "Mahj",
	["maja"] = "Maya",
	["makasar"] = "Maka",
	["malajálam"] = "Mlym",
	["mandaic"] = "Mand",
	["manichaean"] = "Mani",
	["marchen"] = "Marc",
	["masaram gondi"] = "Gonm",
	["matematikai jelölés"] = "Zmth",
	["medefaidrin"] = "Medf",
	["meghatározatlan"] = "Zyyy",
	["meitei mayek"] = "Mtei",
	["mende"] = "Mend",
	["meroitic cursive"] = "Merc",
	["meroitic hieroglyphic"] = "Mero",
	["modi"] = "Modi",
	["mongolian"] = "Mong",
	["morse code"] = "Morse",
	["mro"] = "Mroo",
	["multani"] = "Mult",
	["n'Ko"] = "Nkoo",
	["nabataean"] = "Nbat",
	["new tai lue"] = "Talu",
	["newa"] = "Newa",
	["nushu"] = "Nshu",
	["ogham"] = "Ogam",
	["ol chiki"] = "Olck",
	["old italic"] = "Ital",
	["old sogdian"] = "Sogo",
	["oriya"] = "Orya",
	["orkhon runes"] = "Orkh",
	["osage"] = "Osge",
	["osmanya"] = "Osma",
	["palmyrene"] = "Palm",
	["pau cin hau"] = "Pauc",
	["pazend"] = "pal-Avst",
	["phags-pa"] = "Phag",
	["pollard"] = "Plrd",
	["psalter pahlavi"] = "Phlp",
	["rejang"] = "Rjng",
	["rumi numerals"] = "Ruminumerals",
	["rúna"] = "Runr",
	["samaritan"] = "Samr",
	["saurashtra"] = "Saur",
	["shahmukhi"] = "pa-Arab",
	["sharada"] = "Shrd",
	["shavian"] = "Shaw",
	["siddham"] = "Sidd",
	["signWriting"] = "Sgnw",
	["sogdian"] = "Sogd",
	["sorang sompeng"] = "Sora",
	["soyombo"] = "Soyo",
	["syloti nagri"] = "Sylo",
	["symbol"] = "Zsym",
	["szingaléz"] = "Sinh",
	["szundanéz"] = "Sund",
	["szír"] = "Syrc",
	["tagbanwa"] = "Tagb",
	["tai nüa"] = "Tale",
	["tai tham"] = "Lana",
	["tai viet"] = "Tavt",
	["takri"] = "Takr",
	["tamil"] = "Taml",
	["tangut"] = "Tang",
	["telugu"] = "Telu",
	["tengwar"] = "Teng",
	["thaana"] = "Thaa",
	["thai"] = "Thai",
	["tibetan"] = "Tibt",
	["tifinagh"] = "Tfng",
	["tirhuta"] = "Tirh",
	["ugaritic"] = "Ugar",
	["uncoded"] = "Zzzz",
	["unspecified"] = "None",
	["vai"] = "Vaii",
	["varang kshiti"] = "Wara",
	["yi"] = "Yiii",
	["zanabazar square"] = "Zanb",
	["zenei jelölés"] = "musical",
	["zhang-Zhung"] = "xzh-Tibt",
	["zhuyin"] = "Bopo",
	["ékírás"] = "Xsux",
	["ócirill"] = "Cyrs",
	["ódélarab"] = "Sarb",
	["ómagyar"] = "Hung",
	["ópermi"] = "Perm",
	["óperzsa"] = "Xpeo",
	["óészakarab"] = "Narb",
	["örmény"] = "Armn",
}

local export = {}

local function generate_table(name_to_code)
	local result = {}
	local script_data = mw.loadData("Module:scripts/data")
	
	local iterate
	if name_to_code then
		for code, data in pairs(script_data) do
			if not result[data.canonicalName] or #code == 4 then
				-- Sometimes, multiple scripts have the same name, e.g. 'Arab',
				-- 'fa-Arab', 'ur-Arab' and several others are called "Arabic".
				-- Prefer the one with four characters when disambiguating.
				result[data.canonicalName] = code
			end
		end
	else
		for code, data in pairs(script_data) do
			result[code] = data.canonicalName
		end
	end
	
	return result
end

local function dump(data, name_to_code)
	local output = { "return {" }
	local i = 1
	local sorted_pairs = require "Module:table".sortedPairs
	
	for k, v in sorted_pairs(data) do
		i = i + 1
		output[i] = ('\t[%q] = %q,'):format(k, v)
	end
	
	table.insert(output, "}")
	
	return table.concat(output, "\n")
end

function export.code_to_name(frame)
	return require "Module:debug".highlight(dump(generate_table(false), false))
end

function export.name_to_code(frame)
	return require "Module:debug".highlight(dump(generate_table(true), true))
end

return export