@ Jim Hawkins, Hockey Kid
Thank you. Finally we are on track. And when you explain it like that I understand that no, it´s no bug, but only leftovers.
My problem with array.insert is that it does not allow Types. So you cannot write myArray.insert() like you can write MyArray.remove(). You have to give it a value.
This became a problem for me as I have three levels of types within types, so the easiest way to increase the indexes was to add a number to the length instead of initializing all my types within types with a default number. Sometimes I just want to add an index (new object) to set it up and then fill it with values later.
This won´t work:
// Project: agk2testmuck
// Created: 2014-11-30
// set window properties
SetWindowTitle( "agk2testmuck" )
SetWindowSize( 1024, 800, 0 )
// set display properties
SetVirtualResolution( 1024, 800)
SetOrientationAllowed( 1, 1, 1, 1 )
Type House
Room as Room[]
Endtype
Type Room
Furniture as integer
Endtype
MyHouse as House[]
MyHouse.insert()
do
sync()
loop
The reason this became a problem for me was that when I deleted an object and it´s array in my editor and then created a new object. It would inherit some leftover values and behave strange. So I´m trying to be a clean and good programmer and prevent future bugs.
So the question now is - how to increase an array with types within types and make sure its content has no leftovers?
A command like copy or duplicate could be handy:
MyArray[0].duplicate( MyArray[MyArray.length] )
I could then use index zero as a template with default values and copy them to the newly created index
I never want what I know.