Array -Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Variable Definitions and Operations > Array -Commands >

Array -Commands

ARR.Set Array

Previous Top Next


MiniRobotLanguage (MRL)

 

ARR.Set Array

Set Array Element to String Content

 

clip0700

 

Intention

 

The ARR.Set command is designed to set the value of a specific element in a specified array.

This is useful for populating arrays with data or updating existing elements:

Element Update: The command sets the value of the element at the specified index (P2) in the specified array (P1).

Data Types: The value (P3) can be a string or a binary string.

Default Value: If P3 is omitted, the element at the specified index will be cleared (set to an empty string).

Auto-Dim: if you specify an Index that is "Out of range" (higher then dimensioned), then the engine will increase the dimension of the Array automatically to that size.

 

 

 

 

Syntax

 

ARR.Set Array|P1|P2[|P3]

ARR.Set|P1|P2[|P3]

 

 

Parameter Explanation

 

P1 - Array Number: Specifies the array number, which can range from 0 to 32.

P2 - Array Index: Specifies the index of the element within the array that you want to set. If the Index is larger then the currently reserved number of Elements the Smart Package Robot will automatically try to Re-Dim the Array, this not influence Elements in the Array.

P3 - Value (Optional): Specifies the value to set for the element at the given index. This can be a string or a binary string. If omitted, the Array element with that number P2 will be cleared (set to an empty string).

 

 

Speed in Ticks:

 

clip0782

 

Example

 

'***********************************

' ARR.-Sample for setting an array element

'***********************************

' Sets the 10th element of Array 5 to "Hello"

ARR.Set|5|10|Hello

 

END.

 

 

 

Remarks

 

Inside the code, all Datatypes are stored "as String". Means, technically also the INT-Arrays and the FP-Arrays are String-Arrays.

Therefore you can use

 

' Fill Element 0 of Array Nr.1 with the INT-Value of "42" which is stored as an 8-Byte String (64-Bit)

 

' Set Array with an 64-bit signed Integer Value
ARR.Set INT Array|1|0|42

 

' Return Array Content as String

ARR.Get|1|0|$$RET

 

' This will return an Binary value that defines the 64-bit Signed-Integer value for "42"

MBX.$$RET

 

 

Therefore, if you know what you are doing, you can theoretically fill all even Array-Elements with INT Values,

and put in all odd Array-Values Strings (what ever). You can mix the Datatypes as long as you know what is in where.

You can also use another Array to index what Datatype is in which Array-Element and this way construct a mix of Elements.

 

 

 

Limitations:

 

-

 

 

See also:

 

    VAB. - Variable Binary

    VAC. - Variable reCt

    VAN. - Variable Numeric

    VAO. - Variable Once

    VAP. - Variable Point

    VAR. - Variable Set Value/Clear

    VAS. - Variable with String

    VAV. - Variables with Variables

    VBA. - Variable Binary Append

    CAL. - mathematical CALculation

    2.1 : - Definiton-Command

 

See also:

ARR_---3D---Arrays

ARR_---4D---Arrays

SDO.Arr----Sample-Script

SDO.Arr----Small-Introduction-To-A

Append Array

Clm Array

Clr Array

Dim Array

Get Array

Get FP Array

Get INT Array

Pack-Array-to-File

Pack-Array-to-FileDelimiter

Pack-Array-to-Var

Pack-Array-to-Var

Send to AI

Set Array

Set FP Array

Set INT Array

Unpack-Array-from-File

Unpack-Array-from-File_Delimiter

Unpack-Array-from-Var

Unpack-Array-from-Var_Delimiiter