"The disadvantage is that adding or removing items may only be done via InsertItem() and RemoveItem(). You must not add or remove items from optimized lists by modifying the table directly. It's necessary to use the functions mentioned above. "
But is this considered modifying the list (Referring to line Temp[40][1].a = 5):
Code: Select all
temp = CreateList()
For n=0 To 100
InsertItem(Temp, {[0] = { a=n },
[1] = { a=n+2 }
}, n)
Next
Temp[40][1].a = 5
DebugPrint(Temp[40][1].a)
Also, can the CreateList then contain any kind of Items, as in could I mix Functions, Numbers, Strings, or Subtables with different configurations, like:
Code: Select all
Function MyPrint()
Debugprint("Hello World")
EndFunction
Temp = CreateList()
Table1 = { [0] = {a=1},
[1] = {b=2},
c = 3}
Table2 = { [2] = {a=4},
b = 5}
Func = MyPrint
InsertItem(Temp, Table1)
InsertItem(Temp, Table2)
InsertItem(Temp, Func)
InsertItem(Temp, "string")
InsertItem(Temp, 10)