Description
|
Receives a data packet from a communication tube previously opened with sim.tubeOpen. The tube needs to be connected (see sim.tubeStatus).
|
C synopsis
|
simChar* simTubeRead(simInt tubeHandle,simInt* dataLength)
|
C parameters |
tubeHandle: the handle of the tube that was returned by the simTubeOpen function.
dataLength: size of the returned data packet
|
C return value
|
Pointer to a data packet, or NULL if nothing could be read. The user is in charge of releasing the returned buffer with simReleaseBuffer.
|
Lua synopsis
|
string data=sim.tubeRead(number tubeHandle,boolean blockingOperation=false)
|
Lua parameters |
tubeHandle: Same as C-function
blockingOperation: if true, then the call will block until something can be read or until an error occurred. The script should be threaded in that case. Default value is false.
|
Lua return values
|
data: string containing the received data, or nil in case of an error or if no data is present. If received data is packed, see also the data packing/unpacking functions.
|