메뉴 건너뛰기

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

다운로드

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 추천 수 날짜 최근 수정일
18 리캡챠 적용 [1] 노루발 11   2021-01-08 2021-01-11 12:15
XE 회원가입 시 구글 리캡챠 인증 추가하기 : 네이버 블로그 (naver.com)  
17 certbot을 이용한 HTTPS 인증서 발급 및 적용 노루발 18   2021-01-12 2021-01-12 16:57
snap 설치 및 업데이트 sudo snap install core; sudo snap refresh core certbot 설치 sudo snap install --classic certbot 심볼릭 링크 생성 sudo ln -s /snap/bin/certbot /usr/bin/certbot nginx에 맞춰 자동 설정 sudo certbot --nginx 알아서 다 해주기...  
16 love2d에서 안드로이드 터치 제스처 인식하기 노루발 20   2020-11-12 2020-11-12 00:38
-- 안드로이드/iOS 등등의 터치스크린 입력을 받는 기기에서는 총 3가지의 콜백 함수를 사용한다: -- love.touchpressed / love.touchmoved / love.touchreleased -- 다만 위 3가지 함수는 마우스 클릭으로는 발생하지 않으므로 추가적인 처리가 필요하다. -- ...  
15 Lua 클래스 만들고 활용하기 노루발 23   2020-11-06 2020-11-06 22:43
------------------------ stairs.lua ------------------------ Stairs = {} function Stairs:new(x, y, floor, direction, locked) local newStairs = {x = x, y = y, floor = floor, direction = direction, locked = locked} self.__index = self retur...  
14 Lua 테이블 안에 함수 저장하기 노루발 28   2020-11-06 2020-11-06 21:07
테이블 안에 함수를 저장할 수 있다. function move(object, direction) print(object .. " moved to ".. direction) end scheduler = {} scheduler.queue = {} function scheduler.newentry(action, args) scheduler.queue[#scheduler.queue + 1] = {} schedu...  
13 루아 스타일 가이드 노루발 33   2020-11-19 2020-11-19 00:58
http://lua-users.org/wiki/LuaStyleGuide https://github.com/Olivine-Labs/lua-style-guide  
12 Lua 인수로 nil값이 들어왔을 경우 처리하기 노루발 36   2020-11-06 2020-11-06 20:29
or 연산자를 사용한다. 예제 코드: function moveplayer(direction) direction = direction or "nowhere" print("player moved to ".. direction) end moveplayer() --> "player moved to nowhere" moveplayer("north") -- "player moved to north" 이런 코드...  
11 이쁜 눈나가 유니티 개발 알려주는 재생목록 노루발 37   2020-11-12 2020-11-12 05:59
https://www.youtube.com/watch?v=Ur2jN6_si6c&list=PLi-ukGVOag_1lNphWV5S-xxWDe3XANpyE https://www.youtube.com/watch?v=sJClf9S7AMA&list=PLi-ukGVOag_0HR09oTs966Wt81IYYXlFH 유니티를 배우고 있는 건 아닌데 만들어진 라이브러리를 다루는게 아...  
10 Love2d 이미지 하얗게 그리기 노루발 42   2020-11-23 2020-11-23 04:11
아래와 같은 코드를 사용해 이미지에 색상을 적용할 수 있다. hamster = love.graphics.newImage("hamster.png") love.graphics.setColor(1, 0, 0) -- 빨간색으로 그리기 love.graphics.draw(hamster) love.graphics.setColor(1, 1, 1) 하지만 이미지를 하얗게...  
9 특정좌표를 기준으로 zoom in/zoom out하기 노루발 58   2020-11-11 2020-11-11 01:22
-- x,y - 줌인/줌아웃시 기준점 (좌표 이동이나 scale에 영향받지 않는 순수한 화면 좌표) -- scale - 현재 scale(1:그대로 0.5:1/2 사이즈 2:2배 사이즈) -- scaleinc - 얼마나 scale을 변화시킬것인가 (I usually use 0.1 or -0.1) -- camx - 카메라의 x좌표...  
8 Windows To Go와 R-Studio를 이용한 손실된 데이터 복구하기 노루발 89   2020-01-30 2020-01-30 19:52
하기의 복구 방법으로 모든 자료를 100% 복구할 수는 없으므로 자료의 손실 이전에 신뢰성 있고 주기적인 백업이 선행되어야 한다. 준비물: - 부팅 USB 혹은 외장 HDD/SSD - 복구한 자료를 저장할 외부 저장장치 (옵션) - R-Studio https://www.r-studio.com/ ...  
7 Oracle cloud에 Nginx/MariaDB 설치하기 노루발 93   2020-12-06 2020-12-06 20:19
https://itreport.tistory.com/624  
6 Love2d DPI 이슈 해결 [3] 노루발 97   2019-06-29 2019-07-01 06:34
이런 love 프로젝트가 있다고 하자. (conf.lua) function love.conf(t) t.window.width = 640 t.window.height = 360 end 창 크기를 640*480으로 설정한 뒤 실행하면 어떻게 보일까? 당연히 창 크기가 640*480 크기로 보여야겠지만 내 컴퓨터에서는 이렇게 보...  
5 Love2d로 만든 로그라이크 예제 노루발 252   2020-11-30 2020-11-30 22:54
https://gitlab.com/Jalexander39/roguelikedev-does-the-complete-roguelike-tutorial 이걸 왜 여태 몰랐지...  
4 Love2d 게임 중간에 광고 표시 [1] 노루발 377   2015-11-12 2015-11-17 00:16
http://love2d.org/forums/viewtopic.php?f=11&t=81224  
3 턴 기반 시스템 구현에 대한 글 [4] 노루발 440   2020-11-14 2020-11-18 05:49
플레이어와 NPC들의 모든 행동에 1턴이 소요된다면 턴 기반 시스템의 구현이 쉽겠지만 (사실 엄청 쉽지는 않다... 게임엔진은 실시간으로 돌아가는데 행동은 턴으로 제약해야 하니) 전략성을 요구하기 위해 행동에 소모되는 턴을 다르게 설정한다면 다소 생각...  
2 문D라이브 2008년 5월 19일 버전 [2] 혼돈 3747   2008-06-02 2015-12-09 08:06
휴가루 웍휴2를 개발하면서 조금씩 수정 중이지만, 미스릴님의 요청이 있어서 올립니다. 대화창에 관련되서 완성되었다는 것과 흥크립트 부분이 많이 변했다는 것이 주요 변경점입니다. 대화창의 경우 기본은 대화창이 없는 상태로 MakeDlgBox를 사용하면 크기...  
» 자동화된 Lua 스크립트의 문서화 - LDoc 노루발 43226   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 문서 코멘트라는걸...