GS2-Script Transaction Actions
Specification of verify/consume/acquire transaction actions
AcquireAction
Gs2Script:InvokeScript
Execute the script
Synchronously executes the specified Lua script with the provided JSON arguments. Returns the execution result including status code, return value, transaction information, random number state, execution time, and standard output. Supports transaction handling for atomic operations across GS2 services.
Supports quantity specification: NO
Whether the action is reversible: NO
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| scriptId | string | ✓ | ~ 1024 chars | Script GRN | ||
| userId | string | ~ 128 chars | User ID Set #{userId} to replace the currently logged in user ID. | |||
| args | string | “{}” | ~ 5242880 chars | Arguments (JSON Format) | ||
| randomStatus | RandomStatus | Random number status | ||||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
{
"action": "Gs2Script:InvokeScript",
"request": {
"scriptId": "[string]Script GRN",
"userId": "[string]User ID",
"args": "[string]Arguments (JSON Format)",
"randomStatus": {
"seed": "[long]Random Seed",
"used": [
{
"category": "[long]Category",
"used": "[long]Used Count"
}
]
},
"timeOffsetToken": "[string]Time offset token"
}
}action: Gs2Script:InvokeScript
request:
scriptId: "[string]Script GRN"
userId: "[string]User ID"
args: "[string]Arguments (JSON Format)"
randomStatus:
seed: "[long]Random Seed"
used:
- category: "[long]Category"
used: "[long]Used Count"
timeOffsetToken: "[string]Time offset token"transaction.service("script").acquire.invoke_script({
scriptId="[string]Script GRN",
userId="[string]User ID",
args="[string]Arguments (JSON Format)",
randomStatus={
seed="[long]Random Seed",
used={
{
category="[long]Category",
used="[long]Used Count"
}
}
},
timeOffsetToken="[string]Time offset token",
})