Module:User:InscrutableTed/zh-list-zs

local export = {} local m_phonetic = mw.loadData("Module:zh-glyph/phonetic")

function m_och(char) local success, result = pcall(mw.loadData, "Module:zh/data/och-pron-ZS/" .. char); return (success and result[1][6]) or "" end

function export.show(frame) local glyphs = {} for _, values in pairs(m_phonetic) do 		for value in mw.text.gsplit(values, "") do			table.insert(glyphs, value) end end table.sort(glyphs); local result = { }

local pagesize = 500; local numitems = #glyphs; local numpages = math.ceil(numitems / pagesize);

local n = tonumber(mw.ustring.match(mw.title.getCurrentTitle.text, "%d+$")); if n == 0 or not n then n = 1 end

table.insert(result, "Page " .. n .. " of " .. numpages); local other = ""; if n == 2 then other = other .. "← Previous page" elseif n > 1 then other = other .. "← Previous page" end if n < numpages then other = other .. "→ Next page" end table.insert(result, "\n " .. other .. " \n") table.insert(result, " \n"); for k, glyph in ipairs(glyphs) do		if k > (n - 1) * pagesize and k <= n * pagesize then local och = m_och(glyph) table.insert(result, glyph .. "," .. och .. "\n") end end table.insert(result, " \n"); table.insert(result, "\n " .. other .. " ") return table.concat(result) end

return export