void = List_Insert(sListVarName,nIndex,sSomeText,nSomeNumber)
This macro function is used to insert a string (sSomeText) and a number (nSomeNumber) before the nIndex element of an existing list.
Each element of a list contains a string and an associated integer. When calling the present function, supply 0 for the number if you do not need it

In the image above the item Algeria=Algerien with number 10183 is inserted before the third item of the list.
The code below is used to achieve this.
List_Clear(sListCountries)
// put some values in the list
List_Add(sListCountries, 'Egypt=Ägypten', 10133) // item 1
List_Add(sListCountries, 'Albania=Albanien', 10165) // item 2
List_Add(sListCountries, 'Andorra=Andorra', 10167) // item 3
List_Add(sListCountries, 'Armenia=Armenien', 10180) // item 4
// insert a new entry before the third element
List_Insert(sListCountries, 3, 'Algeria=Algerien', 10183) // item 3
// check that the new third element is the one we inserted
sResult = List_GetName(sListCountries, 3) // 'Algeria'
Creation and Destruction of Lists
When using lists, don't forget to use the function List_Create to create your list at the top of the macro, and then the function List_Destroy to destroy it at the end of the macro.
See also: List_Add, List_Delete, List_Put, list macro functions.
Topic 188830, last updated on 11-Oct-2026