@fubarpk i really don't have a problem inserting the object in an array, the problem is, the insertet object is a copy, when I would have wanted it to be that very object (modifying the array OR MT would modify BOTH)
@Qugurun well, the workaround is, well, like any workaround, longer:
the objective of having refs of an object is to be able to access one very unique instance of an object at any point in the code, so i'd do this: keep only one real instance of the object, by assigning a unique ID to each object
coming from OOP anguage, here is how i m developping my objects around the fact there's no OOP in AppGameKit:
Global gLastUniquID as Integer //global to the whole project, to ensure every ID is completely unique, it increases every time an object is declared
Global gRootArrayMyType as MyType[] //the root array containing what my game currently needs as far as MyType objects goes
Type MyType
ID as Integer
//some other variables in that object
EndType
//then, every method that would have been inside MyType as a class is declared like the constructor
Function MyType_New()
local lObj as MyType
inc gLastUniquID, 1
lObj.ID = gLastUniquID
//do what has to be done to initialise your object
EndFunction lObj
Function MyType_Update(lObj ref as MyType)
//i like, in the flow of my games, to have each object being able to update itself
EndFunction
local lObj as MyType = MyType_New()
local lTempArrayMyType as integer[]
lTempArrayMyType.Insert(lObj.ID) //the "fake ref" is using the ID to always be able to find lObj in its "root array"
//......
//much later in the code i need to modify lObj, but by using lTempArrayMyType
for i = 0 to gRootArrayMyType.Length-1
if gRootArrayMyType[i].ID = lTempArrayMyType[0].ID
//Modify gRootArrayMyType[i]
Exit
EndIf
next i
so now, to put my object in an array "by ref", i would simply put its unique ID in the array, and always work on the global array that I like to call the "root" array, the one containing the real object