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

TypeConditionRequiredDefaultValue LimitsDescription
scriptIdstring
~ 1024 charsScript GRN
userIdstring~ 128 charsUser ID
Set #{userId} to replace the currently logged in user ID.
argsstring“{}”~ 5242880 charsArguments (JSON Format)
randomStatusRandomStatusRandom number status
timeOffsetTokenstring~ 1024 charsTime 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",
})