GS2-Limit 스크립트 트리거 레퍼런스

확장 스크립트를 호출하는 이벤트 트리거의 레퍼런스

트리거

countUp

카운트업

동기 실행 스크립트

카운트업 처리 전에, 스크립트가 동기 실행됩니다.

Request
타입 설명
namespace Namespace 네임스페이스
limitModel LimitModel 횟수 제한 모델
counter Counter 카운터
userId string 사용자ID
countUpValue int 카운트업할 양
maxValue int 카운트업을 허용하는 최댓값
Result
타입 필수 기본값 값 제한 설명
permit bool
✓
카운트업을 허용할지 여부
구현 예제
-- Request
local namespace = args.namespace
local limitModel = args.limitModel
local counter = args.counter
local userId = args.userId
local countUpValue = args.countUpValue
local maxValue = args.maxValue

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}

비동기 실행 스크립트

카운트업 처리 후에, 스크립트가 비동기 실행됩니다.

Request
타입 설명
namespace Namespace 네임스페이스
limitModel LimitModel 횟수 제한 모델
oldCounter Counter 업데이트 전 카운터
newCounter Counter 업데이트 후 카운터
userId string 사용자ID
countUpValue int 카운트업할 양
maxValue int 카운트업을 허용하는 최댓값
구현 예제
-- Request
local namespace = args.namespace
local limitModel = args.limitModel
local oldCounter = args.oldCounter
local newCounter = args.newCounter
local userId = args.userId
local countUpValue = args.countUpValue
local maxValue = args.maxValue

-- 비동기 스크립트는 일반적으로 API 응답에 영향을 주지 않습니다.
-- 로그 출력이나 분석, 외부 알림 등에 사용됩니다.

result = {
}