메뉴 건너뛰기

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

다운로드

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?
 
 
분류 :
조회 수 :
43226
등록일 :
2021.01.11
11:53:51 (*.47.15.90)
엮인글 :
게시글 주소 :
https://hondoom.com/zbxe/index.php?mid=study&document_srl=819158
List of Articles
번호 제목 글쓴이 날짜sort 조회 수
185 질문 있습니다.. C언어 인거 같은데 [7] 포오ㅏ로 2005-02-24 1957
184 밑에 포와로님의 질문 답 [4] 대슬 2005-02-24 1900
183 흑곰님 질문 [2] 라컨 2005-08-22 2015
182 퀴즈소스입니다 허클베리핀님 라컨 2005-08-23 2546
181 비베 질문 [2] 재피디 2005-09-10 1888
180 액션알피지 원거리 무기 질문 [8] 아리포 2006-01-18 1741
179 여러분 질문있어요. 성심성의껏좀 알려주세요 흑흑 [6] 케르메스 2006-02-11 2022
178 [질문]알만툴 게임 [1] 허클베리핀 2006-12-28 1974
177 똥똥배의 게임대회 이야기(1) 혼돈 2007-02-06 2953
176 똥똥배의 게임대회 이야기(2) [2] 혼돈 2007-02-07 2816
175 똥똥배의 게임대회 이야기(3) [1] 혼돈 2007-02-08 3007
174 똥똥배의 게임대회 이야기(4) [1] 혼돈 2007-02-10 2881
173 스크립트 질문좀 하겠습니다....이벤트에 대한것!! [2] 여유 2007-04-23 1859
172 질문요.C++ [7] 질문자01 2007-05-10 2729
171 흥크립트 0.9 새 기능 소개 [3] file 혼돈 2007-10-15 2289
170 흥크립트 Ver0.9 변수 안의 변수 기능 [2] 혼돈 2007-10-16 2208
169 혼돈형한테 질문 (페인트샾 관련) [2] file 장펭돌 2007-11-19 939
168 혼돈형에게 질문! [3] 장펭돌 2007-11-28 1851
167 질문 2가지+1 [2] file Wonder 2007-11-30 1964
166 흥크립트로 만든 예제 [1] file 대슬 2007-12-01 2051