ParaDataStore.UpdateData

Declaration

ok, ret_value, info = UpdateData(key, updateFunction)

Parameters

Parameter NameTypeDescription
keystringKey of the data to be updated.
updateFunctionupdateFunction(currentValue, ParaDataInfo info)
{return newValue, new_options}
Function used for updating the data.

Return Values

Response NameTypeDescription
okintIf the value is 0, the operation is successful. The subsequent fields are the updated value and detailed information.
valuenumber, boolean, string,
or table containing only these types
If the operation is successful, the updated value is returned. Otherwise, an error message is returned.
infoParaDataInfoIf the operation is successful, the detailed information (such as version and metadata) is returned.

Description

Updates the data corresponding to a key through a callback function. The callback function gets the current value and returns the new value based on the defined logic. The callback function cannot be paused once executed.

Callback Function Signature

newValue, newOptions updateFunction(currentValue, info)

Parameters

Parameter NameTypeDescription
currentValuenumber, boolean, string,
or table containing only these types
Current value.
infoParaDataInfoAdditional information about the current value.
newValuenumber, boolean, string,
or table containing only these types
Expected new value.
newOptionsParaDataSetOptionsMetadata expected to be stored.

Description

Updates data with a function.