> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Limit Script Trigger Reference

Reference for event triggers that call extended scripts



## Trigger

### countUp

Count up

**Related methods:**
countUp - Count-up


#### Synchronous Execution Script

The script is executed synchronously before the count up process.

##### Request

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| limitModel | [LimitModel](../sdk/#limitmodel) | Usage Limit Model |
| counter | [Counter](../sdk/#counter) | Counter |
| userId | string | User ID |
| countUpValue | int | Amount to count up |
| maxValue | int | Maximum value allowed to count up |

##### Result

|  | Type | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | Whether to allow count up |

##### Implementation Example


**Lua**
```lua

-- 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

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| limitModel | [LimitModel](../sdk/#limitmodel) | Usage Limit Model |
| oldCounter | [Counter](../sdk/#counter) | Counter before update |
| newCounter | [Counter](../sdk/#counter) | Counter after update |
| userId | string | User ID |
| countUpValue | int | Amount to count up |
| maxValue | int | Maximum value allowed to count up |


##### Implementation Example


**Lua**
```lua

-- 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.
-- These scripts are typically used for logging, analytics, external notifications, and similar purposes.

result = {
}
```


---
  



