메뉴 건너뛰기

창작에 관련된 질문이나 간단한 팁, 예제를 올리는 곳

다운로드

https://github.com/lunarmodules/LDoc

 

penlight 설치가 필요

luarocks install penlight

 

프로젝트가 있는 폴더에서 아래의 명령행을 실행

lua /path/to/ldoc/ldoc.lua $*

 

https://stevedonovan.github.io/ldoc/manual/doc.md.html

 

문서 코멘트라는걸 작성하면 나중에 문서로 취합해줌

모든 문서 코멘트는 세 개의 하이픈(---)으로 시작

--- 예시 문서 코멘트

-- @tag 태그1

-- @tag 태그2

 

자주 사용하는 태그의 종류로는

@module - 모듈

@script - 루아 프로그램

@author, copyright, license, release - 프로젝트 레벨 태그들에 쓰이는 태그 (예: @module)

@function - 함수

@param - 파라미터 (여러개 가능)

@return - 함수의 리턴값 (여러개 가능)

@usage - 예제 사용법

@table - 루아 테이블

@fixme, todo, warning - 안내를 위한 주석

 

모듈에 적용

--- a test module

-- @module test

local test = {}

function test.my_module_function_1()

    ...

end

...

return test

 

함수에 적용

--- foo explodes text.

-- It is a specialized splitting operation on a string.

-- @param text the string

-- @return a table of substrings

function foo (text)

....

end

 

파라미터와 리턴값

-- @param name_of_parameter the description of this parameter as verbose text

-- @return the description of the return value

 

타입을 지정하고 싶을 경우 tparam, treturn 태그를 사용하면 됨

-- @tparam string text this parameter is named 'text' and has the fixed type 'string'

-- @treturn {string,...} a table of substrings

 
param과 return 태그는 여러개 쓸 수 있다.
--- solve a quadratic equation.
-- @param a first coeff
-- @param b second coeff
-- @param c third coeff
-- @return first root, or nil
-- @return second root, or imaginary root error
function solve (a,b,c)
    local disc = b^2 - 4*a*c
    if disc < 0 then
        return nil,"imaginary roots"
    else
       disc = math.sqrt(disc)
       return (-b + disc)/2*a,
              (-b - disc)/2*a
    end
end
 
...
 
todo, fixme 태그
--- Testing annotations
-- @module annot1
...
--- first function.
-- @todo check if this works!
function annot1.first ()
    if boo then
 
    end
    --- @fixme what about else?
end
 
todo, fixme 태그를 추출하기 위해서는 --tags 옵션을 사용
D:\dev\lua\LDoc\tests> ldoc --tags todo,fixme annot1.lua
d:\dev\lua\ldoc\tests\annot1.lua:14: first: todo check if this works!
d:\dev\lua\ldoc\tests\annot1.lua:19: first-fixme1: fixme what about else?
 
 
분류 :
조회 수 :
43228
등록일 :
2021.01.11
11:53:51 (*.47.15.90)
엮인글 :
게시글 주소 :
https://hondoom.com/zbxe/index.php?mid=study&document_srl=819158
List of Articles
번호 제목 글쓴이 조회 수sort 추천 수 날짜 최근 수정일
5 MFC 더블 버퍼링 질문 [2] A.미스릴 6603   2008-06-13 2013-11-23 08:43
void CPingpongView::OnDraw(CDC* pDC) { CPingpongDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here // 현재 창 크기와 같은 DC를 만듬 CRect rect; GetClientRect(&rect); int int_client_width = (rect.ri...  
4 문D 질문 #2 [1] A.미스릴 8797   2008-06-01 2009-01-07 22:05
이거 도배하는거같은 마음이 드네여 ㅈㅅ 제가 대화창을 다뤄봤는데여 CTextDlg textdialog(50); CTextDlg * pt_textdialog(&textdialog); pt_textdialog->SetDlg(100, 100, 200, 200); pt_textdialog->SetColor(255,255,0); pt_textdialog->SetDlgBox("_d...  
3 cocos2d-x 터치와 업데이트 활성화 시키기 똥똥배 10656   2011-10-27 2013-09-13 07:29
cocos2d와 달리, 윈도우 환경에서 cocos2d-x 프로그램을 짜보면 상속을 받았음에도 update, ccTouchesBegan 등의 함수가 작동되지 않음을 알 수 있다. 터치 해결법: OnEnter와 OnExit를 추가하고, 다음 같이 적어준다. void HelloWorld::onEnter() { //단일 ...  
2 VC++ 2008 Express Edition에서 문D라이브 링크 [2] A.미스릴 13090   2008-04-17 2014-04-15 17:28
SDK도 최신버전으로 깔아주었고 도구 설정도 적절하게 했습니다 모든 셋팅이 완료되고 링크를 해보니까 아래와 같은 문장이 쭉쭉나오는군요 warning은 굉장히 많이 나오는데 실제로 컴파일을 막아버린 부분은 LINK : fatal error LNK1104: 'LIBC.lib' 파일을 ...  
» 자동화된 Lua 스크립트의 문서화 - LDoc 노루발 43228   2021-01-11 2021-01-11 11:53
다운로드 https://github.com/lunarmodules/LDoc penlight 설치가 필요 luarocks install penlight 프로젝트가 있는 폴더에서 아래의 명령행을 실행 lua /path/to/ldoc/ldoc.lua $* https://stevedonovan.github.io/ldoc/manual/doc.md.html 문서 코멘트라는걸...