편집 요약 없음
편집 요약 없음
3번째 줄: 3번째 줄:


local p = {}
local p = {}
----------------------  codepoint  --------------------------------------------
function p.tounicode( frame )
function p.tounicode( frame )
local char = getArgs(frame)[1] or nil
local char = getArgs(frame)[1] or nil
11번째 줄: 12번째 줄:
end
end
end
end
function p.tounicode_( char )
function p.tounicode_( char, base )
if type(char) == 'string' then
if type(char) == 'string' then
return 'U+'..ustring.upper(ustring.format("%x", ustring.codepoint(char)))
local baseformat
if base == '16' then baseformat = '%x'
else baseformat = '%d' end
return 'U+'..ustring.upper(ustring.format(baseformat, ustring.codepoint(char)))
else
else
return 0
return 0
end
end
end
end
 
----------------------  next codepoint  ---------------------------------------
function p.nextunicode( frame )
local char = getArgs(frame)[1] or nil
if char then
return p.tounicode_(char)
else
return '입력값이 없습니다.'
end
end
----------------------  prev codepoint  ---------------------------------------
-- string.char
-- string.char
function p.char( frame )
function p.char( frame )