Regular API function

simCallScriptFunction / sim.callScriptFunction (remote API equivalent: simxCallScriptFunction)

Description Calls a script function (from a plugin, the main client application, or from another script). This represents a callback inside of a script. Call this only:
a) from the main thread, or:
b) from a thread that originated from a threaded child script. In that case, you cannot call non-threaded child scripts.
When calling simulation scripts, then simulation must be running. See also sim.executeScriptString and sim.setScriptVariable.
C synopsis From C/C++, call simCallScriptFunctionEx instead.
C parameters
C return value
Lua synopsis ...=sim.callScriptFunction(string functionNameAtScriptName,number scriptHandleOrType,...)
Lua parameters
functionNameAtScriptName: a string representing the function name and script name, e.g. myFunctionName@theScriptName. When the script is not associated with an object, then just specify the function name.
scriptHandleOrType: the handle of the script, otherwise the type of the script:
sim.scripttype_mainscript (0): the main script will be called.
sim.scripttype_childscript (1): a child script will be called.
sim.scripttype_customizationscript (6): a customization script will be called.
...: any number of arguments that will be handed over to the called function.
Lua return values
...: any number of return values from the called function.

All regular API functions on one page