이 모듈에 대한 설명문서는 모듈:한글 처리/설명문서에서 만들 수 있습니다
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
p = {}
---
-- @noSelfInFile *
function p.charCodeAt(char)
local a, b, c = string.byte(char, 1, 3)
return (a - 224) * 4096 + (b - 128) * 64 + c - 128 - 44032
end
function p.convert(text, choseong, jungseong, jongseong)
local result = string.gsub(
text,
"[^%c%p%s%w][^%c%p%s%w][^%c%p%s%w]",
function(char)
local code = charCodeAt(char)
local cho
local jung
local jong
cho = math.floor(code / 588)
code = code - cho * 588
jung = math.floor(code / 28)
code = code - jung * 28
jong = code
return (choseong[cho + 1] .. jungseong[jung + 1]) .. jongseong[jong + 1]
end
)
return result
end
return p