Regular API function


Description Adds or removes custom data to be stored and saved together with an object, a script or a scene (i.e. the data will be part of the object, the script or the scene). If the data name starts with the string "@tmp", then the data will not be saved during a scene or model save operation.See also simReadCustomDataBlock and the data packing/unpacking functions.
C synopsis simInt simWriteCustomDataBlock(simInt objectHandle,const simChar* dataName,const simChar* data,simInt dataSize)
C parameters
objectHandle: handle of the object or script where you want to store your data, or sim_handle_scene if you wish to store the data with the scene.
dataName: a string that identifies the data. An empty string will remove all custom data blocks.
data: your custom data. If NULL, the current data under the specified dataName will be removed.
dataSize: the size of your custom data

The data will be copied to an internal buffer inside of the object or scene, and next time a scene or model is saved, will also be saved. The data buffer can be released after this call.
C return value
-1 if operation was not successful. In a future release, a more differentiated return value might be available
Lua synopsis number result=simWriteCustomDataBlock(number objectHandle,string dataName,string data)
Lua parameters
Same as C-function. In addition, you can specify sim_handle_self for the objectHandle argument, if your target is the current script.
Lua return values
Same as C-function.

All regular API functions on one page