메뉴 건너뛰기

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

테이블 안에 함수를 저장할 수 있다.


function move(object, direction)

    print(object .. " moved to ".. direction)

end


scheduler = {}

scheduler.queue = {}


function scheduler.newentry(action, args)

    scheduler.queue[#scheduler.queue + 1] = {}

    scheduler.queue[#scheduler.queue].action = action

    scheduler.queue[#scheduler.queue].args = args

end


scheduler.newentry(move, {"player", "north"})

scheduler.queue[1].action(table.unpack(scheduler.queue[1].args))


더 이쁘게 할 수 있는 방법이 있겠지만...

분류 :
조회 수 :
28
등록일 :
2020.11.06
20:31:47 (*.127.102.18)
엮인글 :
게시글 주소 :
https://hondoom.com/zbxe/index.php?mid=study&document_srl=818613
List of Articles