|
|
1번째 줄: |
1번째 줄: |
| --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
| | hangul = require("모듈:한글 처리") |
| local p = {}
| |
| -- Lua Library inline imports
| |
| local __TS__StringSplit
| |
| do
| |
| local sub = string.sub
| |
| local find = string.find
| |
| function __TS__StringSplit(source, separator, limit)
| |
| if limit == nil then
| |
| limit = 4294967295
| |
| end
| |
| if limit == 0 then
| |
| return {}
| |
| end
| |
| local result = {}
| |
| local resultIndex = 1
| |
| if separator == nil or separator == "" then
| |
| for i = 1, #source do
| |
| result[resultIndex] = sub(source, i, i)
| |
| resultIndex = resultIndex + 1
| |
| end
| |
| else
| |
| local currentPos = 1
| |
| while resultIndex <= limit do
| |
| local startPos, endPos = find(source, separator, currentPos, true)
| |
| if not startPos then
| |
| break
| |
| end
| |
| result[resultIndex] = sub(source, currentPos, startPos - 1)
| |
| resultIndex = resultIndex + 1
| |
| currentPos = endPos + 1
| |
| end
| |
| if resultIndex <= limit then
| |
| result[resultIndex] = sub(source, currentPos)
| |
| end
| |
| end
| |
| return result
| |
| end
| |
| end
| |
|
| |
|
| local function __TS__StringAccess(self, index)
| | p = {} |
| if index >= 0 and index < #self then
| |
| return string.sub(self, index + 1, index + 1)
| |
| end
| |
| end
| |
|
| |
|
| ---
| | function p.translate(text) |
| -- @noSelfInFile *
| | return hangul.convert( |
| _____CD08_C131 = "rRseEfaqQtTdwWczxvg"
| | text, |
| _____C911_C131 = __TS__StringSplit("k o i O j p u P h hk ho hl y n nj np nl b m ml l", " ")
| | hangul.split("rRseEfaqQtTdwWczxvg", ""), |
| _____C885_C131 = __TS__StringSplit(" r R rt s sw sg e f fr fa fq ft fx fv fg a q qt t T d w c z x v g", " ")
| | hangul.split("k o i O j p u P h hk ho hl y n nj np nl b m ml l", " "), |
| function charCodeAt(char)
| | hangul.split(" r R rt s sw sg e f fr fa fq ft fx fv fg a q qt t T d w c z x v g", " ") |
| local a, b, c = string.byte(char, 1, 3)
| | ) |
| return (a - 224) * 4096 + (b - 128) * 64 + c - 128 - 44032
| |
| end
| |
| function p.dksemfhdj(text)
| |
| local result = string.gsub(
| |
| text,
| |
| "[^%c%p%s%w][^%c%p%s%w][^%c%p%s%w]",
| |
| function(char)
| |
| local code = charCodeAt(char)
| |
| local _____CD08
| |
| local _____C911
| |
| local _____C885
| |
| _____CD08 = math.floor(code / 588)
| |
| code = code - _____CD08 * 588
| |
| _____C911 = math.floor(code / 28)
| |
| code = code - _____C911 * 28
| |
| _____C885 = code
| |
| return (__TS__StringAccess(_____CD08_C131, _____CD08) .. _____C911_C131[_____C911 + 1]) .. _____C885_C131[_____C885 + 1]
| |
| end
| |
| )
| |
| return result
| |
| end
| |
| | |
| function p.translate(frame)
| |
| return p.dksemfhdj(frame.args[1]) | |
| end | | end |
|
| |
|
| return p | | return p |