Module:Hani-sortkey/serializer

Wiktionary වෙතින්

local export = {}

function export.main(checker)
	local sections = {
		{1, 0x3400, 0x9FFF},
		{56, 0xFA0E, 0xFA29},
		{57, 0x20000, 0x2EBEF},
		{178, 0x30000, 0x323AF}
	}
	
	local ret = {}
	for i, section in ipairs(sections) do
		local moduleNum = sections[i][1]
		local module = require(string.format("Module:Hani-sortkey/data/%03d", moduleNum))
		local j = 1
		
		local val = {}
		for i = sections[i][2], sections[i][3] do
			if j == 501 then
				j = j - 500
				moduleNum = moduleNum + 1
				module = require(string.format("Module:Hani-sortkey/data/%03d", moduleNum))
			end
			table.insert(val, module[i] or "\0\0\0\0\0")
			j = j + 1
		end
		val = table.concat(val)
		table.insert(ret, val)
	end
	
	ret = {table.concat(ret)}
	
	if not checker then
		return (mw.dumpObject(ret):gsub("table#1 ", "return "):gsub("\n *", ""))
	else
		return ret
	end
end

return export
"https://si.wiktionary.org/w/index.php?title=Module:Hani-sortkey/serializer&oldid=34819" වෙතින් සම්ප්‍රවේශනය කෙරිණි