Regular API function

simGetUserParameter / sim.getUserParameter

Description Retrieves user parameters attached to an object. Useful for simple interaction with the user. See also sim.setUserParameter, the data packing/unpacking functions and the user config callback functions.
C synopsis simChar* simGetUserParameter(simInt objectHandle,const simChar* parameterName,simInt* parameterLength)
C parameters
objectHandle: handle of the object
parameterName: name of the parameter to retrieve
parameterLength: the number of bytes that compose the value of the parameter (excluding the terminal zero)
C return value
value of the parameter or nullptr if parameterName does not exist for the given object, or in case of an error. The user is in charge of releasing the returned value with simReleaseBuffer. The returned pointer points to parameterLength byte values, terminated by a terminal zero (the returned buffer may however contain several embedded zeros).
Lua synopsis
boolean/number/string parameterValue=sim.getUserParameter(number objectHandle,string parameterName,boolean forceStringReturn=false)
Lua parameters
objectHandle: handle of the object, or sim_handle_self, to target the object the current script is attached to.
parameterName: name of the parameter to retrieve.
forceStringReturn: forces the return of a string (i.e. raw value). False by default. If false, then the returned string will be converted to nil, false, true, a number or a string as appropriate (and in that order).
Lua return values
parameterValue: value of the parameter. If the returned parameter value is a string, then it might contain any values (also embedded zeros)

All regular API functions on one page