GS2-Limit Script Trigger Reference

Reference of event triggers that call extended scripts

Trigger

countUp

Count up

Synchronous Execution Script

The script is executed synchronously before the count up process.

Request
TypeDescription
namespaceNamespaceNamespace
limitModelLimitModelUsage Limit Model
counterCounterCounter
userIdstringUser ID
countUpValueintAmount to count up
maxValueintMaximum value allowed to count up
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow count up
Implementation Example
-- 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
}

Asynchronous Execution Script

The script is executed asynchronously after the count up process.

Request
TypeDescription
namespaceNamespaceNamespace
limitModelLimitModelUsage Limit Model
oldCounterCounterCounter before update
newCounterCounterCounter after update
userIdstringUser ID
countUpValueintAmount to count up
maxValueintMaximum value allowed to count up
Implementation Example
-- 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

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}