Jump to content

Module:Unicode data/datasets

Permanently protected module
From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by MusikBot II (talk | contribs) at 18:00, 15 July 2025 (Protected "Module:Unicode data/datasets": High-risk template or module: 1309 transclusions (more info) ([Edit=Require autoconfirmed or confirmed access] (indefinite))). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local export = {}

local unpack = unpack or table.unpack -- Lua 5.2 compatibility

function export.dataset(dataset_name)
	local dataset = mw.ext.data.get(dataset_name)
	
	if not dataset then error("Dataset " .. dataset_name .. " not found") end
	local data = dataset.data
	local result = {}
	
	for _, item in ipairs(data) do
		local charcode_hex, filename = unpack(item)
		result[tonumber(charcode_hex)] = filename
	end
	
	return result
end

return export