Regular API function

simGetScriptHandle / sim.getScriptHandle

Description Retrieves the handle of a script. A script doesn't directly have a name assigned, however the script inherits the name of its associated object, if it has one. See also the section on accessing general-type objects and sim.isHandleValid.
C synopsis simInt simGetScriptHandle(const simChar* scriptName)
C parameters
scriptName: name of the script. The name of a child script. If the name is left blank, the handle of the main script is retrieved. In order to retrieve the handle of a customization script, use following scriptName prefix: customization@ (for instance, customization@objectName)
C return value
handle of the script if operation was successful, -1 otherwise
Lua synopsis int scriptHandle=sim.getScriptHandle(string scriptName)
Lua parameters
Similar to the C-function counterpart. Alternatively, scriptName can be sim.handle_self, nil or inexistent, in which case the current script's handle is returned
Lua return values
Similar to the C-function counterpart