둘러보기 메뉴
검색
바뀐글
임의글
개인 도구
가입하기
로그인
모바일 환경 설정
도움말
도움말
질문게시판
자주 묻는 질문
커뮤니티
실시간 채팅방
가입인사게시판
자유게시판
뉴스게시판
제재안게시판
최근 토론
페미위키
공지사항
개선 요청
바뀐글
임의글
파일 올리기
다면 분류 목록
특수 문서 목록
모듈:나이 문서 원본 보기
이름공간
모듈
토론
주시
도구
여기를 가리키는 문서
가리키는 글의 최근 바뀜
문서 정보
위키베이스 항목
행위
보기
읽기
원본 보기
역사 보기
←
모듈:나이
문서 편집 권한이 없습니다. 다음 이유를 확인해주세요.
요청한 명령은 다음 중 하나의 권한을 가진 사용자에게 제한됩니다:
사용자
,
Seeders
.
문서를 고치려면 이메일 인증 절차가 필요합니다.
사용자 환경 설정
에서 이메일 주소를 입력하고 이메일 주소 인증을 해주시기 바랍니다.
문서의 원본을 보거나 복사할 수 있습니다.
p = {} local function age(y1, m1, d1, y2, m2, d2) local age = y2 - y1 if m2 < m1 or ( m2 == m1 and d2 < d1 ) then age = age - 1 end return age end local function koreanAge(y1, y2) return y2-y1+1 end -- UnlinkedWikibase 호환 필요 local broken = true function p.main(frame) if broken then return '' end local args = frame.args[1] ~= nil and frame.args or frame:getParent().args -- unpack(args)이 불가하여 하드코딩 local y1 = tonumber(args[1]) local m1 = tonumber(args[2]) local d1 = tonumber(args[3]) local y2 = tonumber(args[4]) local m2 = tonumber(args[5]) local d2 = tonumber(args[6]) local entity = mw.wikibase.getEntity() -- 입력된 출생일이 없다면 if not args[1] then if entity then local birth = entity:getBestStatements('태어난 날') y1, m1, d1 = string.match( birth[1].mainsnak.datavalue.value.time, '(%d+)\-(%d+)\-(%d+)' ) y1 = tonumber(y1) m1 = tonumber(m1) d1 = tonumber(d1) else error('출생일을 입력하지 않았지만 관련 위키베이스 항목을 찾을 수 없습니다.') end end -- 입력된 사망일이 없다면 if not args[4] then local death = entity and entity:getBestStatements('사망한 날') if death and death[1] then y2, m2, d2 = string.match( death[1].mainsnak.datavalue.value.time, '(%d+)\-(%d+)\-(%d+)' ) y2 = tonumber(y2) m2 = tonumber(m2) d2 = tonumber(d2) -- 사망일을 위키베이스에서 못 가져왔다면 오늘을 기준으로 삼기 else local date = os.date( '*t' ) y2 = date.year m2 = date.month d2 = date.day end end local country = entity and frame:callParserFunction( '#property', '국적' ) if country and country == '대한민국' then return koreanAge(y1,y2) .. '세' .. ', 만 ' .. age(y1, m1, d1, y2, m2, d2) .. '세' end return age(y1, m1, d1, y2, m2, d2) .. '세' end return p
이 문서에서 사용한 틀:
모듈:나이/설명문서
(
원본 보기
)
모듈:나이
문서로 돌아갑니다.
다른 언어