Regular API function

simSetReferencedHandles / sim.setReferencedHandles

Description Attaches a list of custom handles to a given scene object. Those custom handles are handles of other scene objects, that are linked to the given scene object (for whatever purpose). The advantage of storing references to other objects with this function is that CoppeliaSim will take care of correctly adjusting the references if needed: For instance, imagine objectA storing the handle of objectB via this function. If objectB is deleted, then the stored handle will become -1. If objectA and objectB are duplicated at the same time, then the duplicate of objectA will store the handle of the duplicate of objectB. Optionally, if sim.handleflag_keeporiginal is specified, then linking to original objects is guaranteed, e.g. in above example, after a duplication of objectA, the duplicate of objectA will store the handle of the original objectB (if objectB still exists). See also sim.getReferencedHandles.
C synopsis simInt simSetReferencedHandles(simInt objectHandle,simInt count,const simInt* referencedHandles,const simInt* reserved1,const simInt* reserved2)
C parameters
objectHandle: handle of the scene object that will store the list of handles. Can be optionally combined with sim.handleflag_keeporiginal, in which case the handles that link to originals are retrieved.
count: the number of handles to store
referencedHandles: a list of scene object handles.
reserved1: reserved for future extensions
reserved2: reserved for future extensions
C return value
-1 in case of an error.
Lua synopsis sim.setReferencedHandles(int objectHandle,table[] referencedHandles)
Lua parameters
Similar to the C-function
Lua return values