Array Operations
Array Operations¶
Alters an Array present in a Variable, allowing you to access indices or resize it.
Index¶
| Name | Explanation |
|---|---|
| Value | Leverages a value, as a Number. |
| Local Variable | Leverages a single Local Variable. |
| Global Variable | Leverages a single Global Variable. |
Count¶
| Name | Explanation |
|---|---|
| Value | Leverages a value, as a Number. |
| Local Variable | Leverages a single Local Variable. |
| Global Variable | Leverages a single Global Variable. |
Note: When increasing the size of the Array, new Indices will be filled with a blank value, similar to unused Variables.
Examples¶
Get Array Value at Index 0 from Global Variable 0, Save to Global Variable 77¶
This retrieves the value at index 0 from the array stored in Global Variable 0 and saves it into Global Variable 77.
{"Data":{"ArrayIndex":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"ArrayReference":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":null,"VariableIndex":0,"Metadata":null},"IsCount":0,"IsGet":1,"IsIndexer":1,"IsSet":0,"Operand":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":null,"VariableIndex":77,"Metadata":null},"Index":0,"IndexEnd":null,"IsLocal":0,"IsOperandReference":0,"IsReference":0,"OperandGlobalIndex":null,"OperandLocalIndex":null,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.Data.ArrayCommand"}
Set Array Value at Variable Index in Global Variable 0 to 45¶
This sets the value at the index specified by Global Variable 2, inside the array stored in Global Variable 0, to 45.
{"Data":{"ArrayIndex":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"0","VariableIndex":2,"Metadata":null},"ArrayReference":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":null,"VariableIndex":0,"Metadata":null},"IsCount":0,"IsGet":0,"IsIndexer":1,"IsSet":1,"Operand":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"45","VariableIndex":77,"Metadata":null},"Index":0,"IndexEnd":null,"IsLocal":0,"IsOperandReference":0,"IsReference":0,"OperandGlobalIndex":null,"OperandLocalIndex":null,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.Data.ArrayCommand"}
Resize Array in Global Variable 1 to 20 Elements¶
This resizes the array stored in Global Variable 1 to 20 elements. New elements are filled with blank values.
{"Data":{"ArrayIndex":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"0","VariableIndex":2,"Metadata":null},"ArrayReference":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":null,"VariableIndex":1,"Metadata":null},"IsCount":1,"IsGet":0,"IsIndexer":0,"IsSet":1,"Operand":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"20","VariableIndex":77,"Metadata":null},"Index":0,"IndexEnd":null,"IsLocal":0,"IsOperandReference":0,"IsReference":0,"OperandGlobalIndex":null,"OperandLocalIndex":null,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.Data.ArrayCommand"}
Get Array Count from Global Variable 1, Save to Global Variable 2¶
This retrieves the number of elements in the array stored in Global Variable 1 and saves it into Global Variable 2.
{"Data":{"ArrayIndex":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"0","VariableIndex":2,"Metadata":null},"ArrayReference":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":null,"VariableIndex":1,"Metadata":null},"IsCount":1,"IsGet":1,"IsIndexer":0,"IsSet":0,"Operand":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"20","VariableIndex":2,"Metadata":null},"Index":0,"IndexEnd":null,"IsLocal":0,"IsOperandReference":0,"IsReference":0,"OperandGlobalIndex":null,"OperandLocalIndex":null,"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.Data.ArrayCommand"}