Skip to main content

getObjectAt

Short summary​

This method returns the object at the given index. Returned objects can be modified, but not replaced! To replace an object use replaceObjectAt. Example: A list of: 1 2 3 after list.getObjectAt(1) will return: object=>2 and return SingleExecutionResult.SUCCESS Example 2: A list of: 1 2 3 after list.getObjectAt(3) will return: object=>NULL and return SingleExecutionResult.ERROR

Return: SingleExecutionResult.SUCCESS: index was valid SingleExecutionResult.ERROR: index was not valid, returned object is undefined

Parameters​

NameTypeCommentKind
indexUDINTthe index to access the object frominput
objectCNM_AbstractObject.IObjectthe object at the given indexoutput

Code​

Declaration​

METHOD getObjectAt :CNM_ReturnTypes.SingleExecutionResult
VAR_INPUT
(*the index to access the object from*)
index :UDINT;
END_VAR
VAR_OUTPUT
(*the object at the given index*)
object :CNM_AbstractObject.IObject;
END_VAR