datahub_write

datahub_write — assigns a value to a DataHub point.

Syntax

datahub_write (pointname, value [, force, quality, timestamp])
    

Arguments

pointname

The name of the point, as a string.

value

The value to be assigned to the point—a number, string, or array.

force

Causes the write to occur even if the value and quality are the same as the value currently in the DataHub. This is useful if you are changing only the time stamp of the point. Enter t to force, or nil to not force.

quality

The quality of a point, as a number. You can use the constants OPC_QUALITY_* found in GetQualityName by requiring that file like this: require("Quality.g");.

timestamp

The time stamp in Windows time. Windows time is a floating point number that can be obtained in Gamma by requiring Time.g like this: require("Time.g");, then calling the functions GetCurrentWindowsTime, UnixTimeToWindowsTime, or PointGetWindowsTime.

Returns

t on success, otherwise an error message.

Description

This function is the same as the Gamma force function, but the pointname is a string, so the symbol never needs to be created in the Gamma engine. This can be used to reduce Gamma engine load when using a large number of points.