Regular API function

simCallScriptFunctionEx

Description Calls a script function (from a plugin, the main client application, or from another script). This represents a user callback inside of a script. The target script must be initialized for this call to succeed, e.g. when calling simulation scripts, then simulation must be running. See also sim.executeScriptString.

Data exchange between a plugin and a script happens via a stack. Reading and writing arguments from/to the stack gives you a maximum of flexibility, and you wil be able to exchange also complex data structures. But it can also be tedious and error prone. Use instead the helper classes located in programming/common/stack and programming/include/stack: they will greatly simplify the task. Have a look at the example plugins simExtSkeletonPlugin and simExtSkeletonPluginNG.
C/C++
synopsis
simInt simCallScriptFunctionEx(simInt scriptHandleOrType,const simChar* functionNameAtScriptName,simInt stackId)
C/C++
parameters
scriptHandleOrType: the handle of the script, otherwise the type of the script
functionNameAtScriptName: the function to call.
if scriptHandleOrType is sim_scripttype_childscript or sim_scripttype_customizationscript, then append to the string '@' and the path of the object the script is attached to, e.g. "func@/path/to/object"
if scriptHandleOrType is sim_scripttype_addonscript, then append to the string '@' and the name of the add-on, e.g. "func@Isometric scaling"
stackId: a stack handle. The stack represents the function's in/out values. See also the available stack functions.
C/C++
return value
-1 in case of an error
Lua synopsis From Lua, call sim.callScriptFunction instead.
Lua parameters
Lua return values
Python synopsis From Python, call sim.callScriptFunction instead.