Inserts an element into an SRP List at the given index position.


SRP_List("InsertAt", Handle, Index, Element)


HandleHandle to an existing SRP List (REQUIRED)
IndexThe position within the SRP List at which the element will be inserted (REQUIRED)
ElementThe value to insert into the SRP List (REQUIRED)


The InsertAt service inserts a value into an SRP List at the given position. Unlike the OI Insert method, passing an index of -1 will not add the element to the end of the array. To perform an add, you need to use the Add service. The reason is speed. In all other ways, however, the InsertAt service works just like the OI Insert function.


// Create the list
Handle = SRP_List("Create")

// Insert several elements
SRP_List("InsertAt", Handle, 1, "ABC")
SRP_List("InsertAt", Handle, 10, "DEF")
SRP_List("InsertAt", Handle, 5, "EFG")

// Convert the SRP List into a normal list
List = SRP_List("GetVariable", Handle, ",")

// List = "ABC,,,,EFG,,,,,,DEF"
// NOTE that DEF is in position 11 because EFG was inserted, not set

// Play nice with memory
SRP_List("Release", Handle)
  • No labels