C
CruelBus
Guest
Well, strange to me anyway. Sooooo....
Take the following array declaration:
eY=[0,0,1,1,2,2,2,2,2,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,2,3,3,3,2,0];
This array is in an object called "ROOMLOAD" that creates another object called "LANDFILL"
In the "LANDFILL" create event:
eY=ROOMLOAD.eY;
works fine, even afer the ROOMLOAD object has performed its destroy event.
The array is passed on once again to another object in the same way, with "LANDFILL" also destroying itself.
All of eY's values are intact and passed along, eventhough the original eY was long since destroyed.
EXPLANATION: This only creates a reference to the array. The information the array holds will not be deleted (garbage collected) until all references to it have been deleted first.
HOWEVER, within the same object:
eyTEMP=eY;
results in an empty array for eyTEMP.
EXPLANATION: (USER ERROR) This empty array reference occurred because eY was also an empty array that I forgot to fill.
How does the above copy method work across objects but not within the same object?
Take the following array declaration:
eY=[0,0,1,1,2,2,2,2,2,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,2,3,3,3,2,0];
This array is in an object called "ROOMLOAD" that creates another object called "LANDFILL"
In the "LANDFILL" create event:
eY=ROOMLOAD.eY;
works fine, even afer the ROOMLOAD object has performed its destroy event.
The array is passed on once again to another object in the same way, with "LANDFILL" also destroying itself.
All of eY's values are intact and passed along, eventhough the original eY was long since destroyed.
EXPLANATION: This only creates a reference to the array. The information the array holds will not be deleted (garbage collected) until all references to it have been deleted first.
HOWEVER, within the same object:
eyTEMP=eY;
results in an empty array for eyTEMP.
EXPLANATION: (USER ERROR) This empty array reference occurred because eY was also an empty array that I forgot to fill.
How does the above copy method work across objects but not within the same object?
Last edited by a moderator: