Module:User:MewBot

local export = {}

function export.getLanguageData(frame) local iparams = { ["first"] = {type = "number"}, ["last"] = {type = "number"}, }	local iargs = require("Module:parameters").process(frame.args, iparams) local m_languages = require("Module:languages") local ret = {}

local index = 0 for code, data in pairs(require("Module:languages/data/all")) do		index = index + 1 if (not iargs.first or index >= iargs.first) and (not iargs.last or index <= iargs.last) then local lang = m_languages.makeObject(code, data, true):toJSON("returnTable") -- Remove blank aliases/varieties/otherNames/ancestors for _, to_remove in ipairs { "aliases", "varieties", "otherNames", "ancestors"} do				if lang[to_remove] and not lang[to_remove][1] then lang[to_remove] = nil end end -- For full languages, "nonEtymological" is always or almost always the same as the lang code; if so, remove it. if lang.nonEtymological == lang.code then lang.nonEtymological = nil end -- For full languages, "type" should always contain "language" and "full"; remove them. local hacked_types = {} for _, typ in ipairs(lang.type) do				if typ ~= "language" and typ ~= "full" then table.insert(hacked_types, typ) end end lang.type = hacked_types table.insert(ret, require("Module:JSON").toJSON(lang)) end end

return "[" .. table.concat(ret, ", ") .. "]" end

function export.getFamilyData(frame) local m_families = require("Module:families") local ret = {} for code, data in pairs(require("Module:families/data")) do		local fam = m_families.makeObject(code, data, true) table.insert(ret, fam:toJSON) end return "[" .. table.concat(ret, ", ") .. "]" end

function export.getScriptData(frame) local m_scripts = require("Module:scripts") local ret = {} for code, data in pairs(require("Module:scripts/data")) do		local sc = m_scripts.makeObject(code, data, true) table.insert(ret, sc:toJSON) end return "[" .. table.concat(ret, ", ") .. "]" end

function export.getEtymLanguageData(frame) local m_languages = require("Module:languages") local ret = {} for code, data in pairs(require("Module:etymology languages/data")) do		local etymlang = m_languages.makeObject(code, data, true, "dont canonicalize aliases") table.insert(ret, etymlang:toJSON) end return "[" .. table.concat(ret, ", ") .. "]" end

return export