Jump to content

Module:Unicode data/datasets

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Dušan Kreheľ (talk | contribs) at 12:18, 15 July 2025 (Copy of wikt:en:Module:Unicode data/datasets (revision n. 85546588).). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(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