Regular API function
simReceiveData / sim.receiveData
Description
|
Deprecated. |
C/C++ synopsis
|
simReceiveData(int dataHeader,const char* dataName,int antennaHandle,int index,int* dataLength,int* senderID,int* dataHeaderR,char** dataNameR)
|
C/C++ parameters |
dataHeader: number indicating who "designed" the communication message. Can also be -1, in which case messages with any dataHeader will be retrieved (not recommended, unless index is different from -1).
dataName: name indicating the type of message. Can be nil, in which case messages with any dataName will be retrieved (not recommended, unless index is different from -1)
antennaHandle: handle of the scene object that should operate as the antenna for this reception. If sim.handle_default is specified, a reception antenna at (0,0,0) is simulated.
index: zero-based index of the message to read. If -1 is indicated, the first message that matches the dataHeader and dataName is read and removed. Otherwise messages are just read.
dataLength: length of the received data (if returned pointer is not nullptr)
senderID: identifier of the sender. Can be the handle of a script if the message was sent from a script, or can be 0 if the message was sent from the non-Lua API. Can be nullptr.
dataHeaderR: dataHeader of the data that was read. Can be nullptr.
dataNameR: dataName of the data that was read. Can be nullptr. The user is in charge of releasing the buffer with simReleaseBuffer(*dataNameR).
|
C/C++ return value
|
pointer to the received data, or nullptr if no data is available or in case of an error. The user is in charge of releasing the returned buffer with simReleaseBuffer.
|
Lua synopsis
|
string data,int senderID,int dataHeader,string dataName=sim.receiveData(int dataHeader=-1,string dataName=nil,int antennaHandle=sim.handle_self,int index=-1)
|
Lua parameters |
dataHeader: number indicating who "designed" the communication message. Can also be -1, in which case messages with any dataHeader will be retrieved (not recommended, unless index is different from -1). This value can be omitted (-1 will be used).
dataName: name indicating the type of message. Can be nil, in which case messages with any dataName will be retrieved (not recommended, unless index is different from -1). This value can be omitted (nill will be used)
antennaHandle: handle of the scene object that should operate as the antenna for this reception. If sim.handle_default is specified, a reception antenna at (0,0,0) is simulated. If sim.handle_self is specified, the object associated with the current child script is used as the antenna. This value can be omitted (sim.handle_self will be used)
index: zero-based index of the message to read. If -1 is indicated, the first message that matches the dataHeader and dataName is read and removed. Otherwise messages are just read. This value can be omitted (-1 will be used)
|
Lua return values
|
senderID: identifier of the sender. Can be the handle of a script if the message was sent from a script, or can be 0 if the message was sent from the non-Lua API.
dataHeader: dataHeader of the data that was read.
dataName: dataName of the data that was read.
|
|