메뉴 건너뛰기

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

다운로드

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?
 
 
분류 :
조회 수 :
43224
등록일 :
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 express.js 세션 적용 후 리다이렉트 시 세션 적용이 제대로 안 되는 문제점 노루발 2024-02-07 4
184 Bootstrap4 container class가 적용된 div의 양 옆에 설정하지 않은 margin이 생김 노루발 2024-02-07 5
183 리캡챠 적용 [1] 노루발 2021-01-08 11
182 certbot을 이용한 HTTPS 인증서 발급 및 적용 노루발 2021-01-12 18
181 love2d에서 안드로이드 터치 제스처 인식하기 노루발 2020-11-12 20
180 Lua-love2d TCP 통신 [1] 노루발 2023-07-14 21
179 illegal character 방지 [3] 노루발 2023-07-17 22
178 Lua 클래스 만들고 활용하기 노루발 2020-11-06 23
177 Lua 테이블 안에 함수 저장하기 노루발 2020-11-06 28
176 루아 스타일 가이드 노루발 2020-11-19 33
175 Lua 인수로 nil값이 들어왔을 경우 처리하기 노루발 2020-11-06 35
174 이쁜 눈나가 유니티 개발 알려주는 재생목록 노루발 2020-11-12 37
173 Love2d 이미지 하얗게 그리기 노루발 2020-11-23 42
172 Love2d 게임 안드로이드로 패키징하기 노루발 2021-01-11 48
171 특정좌표를 기준으로 zoom in/zoom out하기 노루발 2020-11-11 57
170 Windows To Go와 R-Studio를 이용한 손실된 데이터 복구하기 노루발 2020-01-30 88
169 Oracle cloud에 Nginx/MariaDB 설치하기 노루발 2020-12-06 93
168 Love2d DPI 이슈 해결 [3] 노루발 2019-06-29 97
167 Love2d로 만든 로그라이크 예제 노루발 2020-11-30 250
166 love.update(dt) 에서 버벅이는 현상. 노루발 2013-09-17 256