Regular API function

simSetScriptSimulationParameter / sim.setScriptSimulationParameter

Description Sets a main script's or child script's parameter in its simulation parameter list. Useful for simple interaction with the user or for simple parameter exchange with other scripts. See also sim.getScriptSimulationParameter and the data packing/unpacking functions.
C synopsis simInt simSetScriptSimulationParameter(simInt scriptHandle,const simChar* parameterName,const simChar* parameterValue,simInt parameterLength)
C parameters
scriptHandle: handle of the script, or sim_handle_main_script or sim_handle_all
parameterName: name of the parameter to set
parameterValue: value of the parameter (all parameters are treated as strings, but can be converted to number later on. Strings may contain any values (also embedded zeros))
parameterLength: number of bytes that parameterValue contains. If parameterValue is a regular string (without embedded zeros), then this is strlen(parameterValue).
C return value
number of parameters that were set (can be >1 if sim_handle_all was specified) or -1 if the parameterName could not be found or in case of an error
Lua synopsis number setCount=sim.setScriptSimulationParameter(number scriptHandle,string parameterName,string/number parameterValue)
Lua parameters
scriptHandle: handle of the script, or sim.handle_main_script, sim.handle_all, sim.handle_tree, sim.handle_chain or sim.handle_self
parameterName: Same as C-function
parameterValue: Same as C-function
Lua return values
Same as C-function

All regular API functions on one page