Regular API function

simGetScriptHandle / sim.getScriptHandle

Description Retrieves the handle of a script. The operation of this function depends on the current name suffix settings (see sim.getNameSuffix, sim.setNameSuffix, and the section on accessing general-type objects). 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 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 number scriptHandle=sim.getScriptHandle(string scriptName)
Lua parameters
Same as C-function. Alternatively, scriptName can be sim.handle_self, nil or inexistent, in which case the current script's handle is returned
Lua return values
Same as C-function

All regular API functions on one page