모듈:연습장: 두 판 사이의 차이

리버티게임, 모두가 만들어가는 자유로운 게임
백괴게임>Riemann
잔글편집 요약 없음
imported>Hsl0
(내용을 "local p function p.test(frame) return frame:expandTemplate{ title = '사용자:hsl0/연구소/2' } end return p"(으)로 바꿈)
1번째 줄: 1번째 줄:
-- 모듈 연습장입니다.
local p
local getArgs = require('모듈:Arguments').getArgs
local p = {}


p.josa = function(frame)
function p.test(frame)
local arg = getArgs(frame)
return frame:expandTemplate{
return _josa(arg)
title = '사용자:hsl0/연구소/2'
end
}
end


function _josa(args)
local result = {{args[3] or true, args[4] or false, args[5] or nil}, {'은', '는', '은(는)'}, {'이', '가', '이(가)'}, {'을', '를', '을(를)'}, {'으로', '로', '(으)로'}, {'과', '와', '과(와)'}, {'아', '야', '아(야)'}, {'이', '', '(이)'}}
if args[1] == '은는' then
tp = 2
elseif args[1] == '이가' then
tp = 3
elseif args[1] == '을를' then
tp = 4
elseif args[1] == '으로' then
tp = 5
elseif args[1] == '과와' then
tp = 6
elseif args[1] == '아야' then
tp = 7
elseif args[1] == '이' then
tp = 8
else tp = 1
end
local fin = mw.ustring.sub(mw.ustring.toNFD(args[2]), -1, -1)
local fnum = mw.ustring.codepoint(fin)
local code
if (fnum == 4527 or fnum == 12601) then
code = 10
elseif ((4520 <= fnum and fnum <= 4546) or (12593 <= fnum and fnum <= 12622)) then
code = 1
elseif ((4449 <= fnum and fnum <= 4469) or (12623 <= fnum and fnum <= 12643)) then
code = 2
else
code = 3
end
if tp == 5 then
if code == 1 then
josa = result[4][1]
elseif code == 2 or code == 10 then
josa = result[4][2]
else josa = result[4][3]
end
else
if code == 1 or code == 10 then
josa = result[tp][1]
elseif code == 2 then
josa = result[tp][2]
else josa = result[tp][3]
end
end
if tp == 1 or args[3] == '0' then
return josa
else
return table.concat({args[2], josa})
end
end
return p
return p

2021년 5월 20일 (목) 21:00 판


모듈 설명문서[보기] [편집] [역사] [새로 고침]

자유롭게 모듈의 사용법을 익힐 수 있는 연습장입니다.

  1. 장기간에 걸쳐 수정이 필요한 경우 별도로 모듈페이지를 만드는 것을 추천합니다.
  2. 다음 문서가 도움이 될 수 있습니다.
  3. 다른 이름공간에 대한 연습은 아래에서 가능합니다.
  4. 낙서장을 비우려면 여기를 클릭하세요.


local p

function p.test(frame)
	return frame:expandTemplate{
		title = '사용자:hsl0/연구소/2'
	}
end

return p