Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Erutuon/scripts
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} local cp_to_sc = require 'Module:Language/scripts'.codepointToScript local function in_array(arr, val) for i, v in ipairs(arr) do if v == val then return true end end return false end local function mapIter(func, iter, iterable, initVal) local array = {} local i = 0 for x, y in iter, iterable, initVal do i = i + 1 array[i] = func(y, x, iterable) end return array end function p.list_chars_in_script(str) local scripts = {} for codepoint in mw.ustring.gcodepoint(str) do local script = cp_to_sc(codepoint) scripts[script] = scripts[script] or {} local char = mw.ustring.char(codepoint) if not in_array(scripts[script], char) then table.insert(scripts[script], char) end end for script, characters in pairs(scripts) do table.sort(characters) end return table.concat( mapIter( function (codepoints, script) return ('\n* %s: %s') :format(script, table.concat(codepoints)) end, pairs(scripts))) end function p.main(frame) return p.list_chars_in_script(frame.args[1]) end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Module:Language/scripts
(
edit
)
Module:Sandbox/Erutuon/scripts
(
edit
)
Module:Sandbox/Erutuon/scripts/doc
(
edit
)