Jump to content

Module:languages/iterateAll

From Wiktionary, the free dictionary

require("Module:languages/iterateAll")()

This function is expensive

Returns a table containing Language objects for all languages, sorted by code.

This function searches through the whole database of languages, and is therefore relatively resource-intensive. It should be used sparingly.


return function ()
	mw.incrementExpensiveFunctionCount()
	local m_languages = require("Module:languages")
	local m_data = mw.loadData("Module:languages/data/all")
	local func, t, var = pairs(m_data)
	
	return function()
		local code, data = func(t, var)
		return m_languages.makeObject(code, data)
	end
end